From 75c4045c9663debea932437ed12954e74e7e27bd Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 23 Jun 2008 21:21:18 +0000 Subject: Delete obsolete contents git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@670762 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/rfeng/minicore/.checkstyle | 24 - sandbox/rfeng/minicore/.pmd | 20 - sandbox/rfeng/minicore/.ruleset | 190 --- sandbox/rfeng/minicore/LICENSE.txt | 202 ---- sandbox/rfeng/minicore/NOTICE.txt | 14 - sandbox/rfeng/minicore/pom.xml | 74 -- .../binding/local/AbstractLocalTargetInvoker.java | 78 -- .../core/binding/local/LocalBindingBuilder.java | 52 - .../core/binding/local/LocalBindingDefinition.java | 39 - .../core/binding/local/LocalBindingLoader.java | 70 -- .../binding/local/LocalCallbackTargetInvoker.java | 69 -- .../core/binding/local/LocalReferenceBinding.java | 62 - .../core/binding/local/LocalServiceBinding.java | 60 - .../core/binding/local/LocalTargetInvoker.java | 79 -- .../tuscany/core/bootstrap/Bootstrapper.java | 75 -- .../core/bootstrap/DefaultBootstrapper.java | 224 ---- .../tuscany/core/bootstrap/ExtensionActivator.java | 31 - .../tuscany/core/builder/BuilderRegistryImpl.java | 185 --- .../core/builder/ComponentNotFoundException.java | 36 - .../apache/tuscany/core/builder/ConnectorImpl.java | 385 ------ .../core/builder/IllegalCallbackException.java | 36 - .../builder/IncompatibleInterfacesException.java | 40 - .../core/builder/InvalidSourceTypeException.java | 35 - .../core/builder/InvalidTargetTypeException.java | 35 - .../tuscany/core/builder/NoBindingException.java | 35 - .../builder/NoCompatibleBindingsException.java | 34 - .../builder/NoConversationalContractException.java | 37 - .../core/builder/NoRegisteredBuilderException.java | 38 - .../builder/SourceServiceNotFoundException.java | 36 - .../builder/TargetServiceNotFoundException.java | 36 - .../core/builder/WireCreationException.java | 39 - .../builder/WirePostProcessorRegistryImpl.java | 50 - .../core/builder/WiringExceptionFormatter.java | 67 - .../core/component/CallableReferenceImpl.java | 60 - .../core/component/CallbackReferenceImpl.java | 33 - .../core/component/ComponentContextImpl.java | 97 -- .../core/component/ComponentContextProvider.java | 44 - .../core/component/ComponentManagerImpl.java | 109 -- .../tuscany/core/component/ScopeIdentifier.java | 35 - .../core/component/ServiceReferenceImpl.java | 52 - .../tuscany/core/component/SimpleWorkContext.java | 113 -- .../component/SystemSingletonAtomicComponent.java | 138 --- .../tuscany/core/component/WorkContextImpl.java | 214 ---- .../core/component/event/AbstractEvent.java | 39 - .../core/component/event/AbstractRequestEvent.java | 38 - .../core/component/event/ComponentEvent.java | 34 - .../core/component/event/ComponentStart.java | 47 - .../core/component/event/ComponentStop.java | 46 - .../core/component/event/ConversationEnd.java | 31 - .../core/component/event/ConversationStart.java | 31 - .../core/component/event/ConversationalEvent.java | 39 - .../core/component/event/HttpRequestEnded.java | 38 - .../core/component/event/HttpRequestStart.java | 38 - .../core/component/event/HttpSessionEnd.java | 38 - .../core/component/event/HttpSessionEvent.java | 45 - .../core/component/event/HttpSessionStart.java | 38 - .../tuscany/core/component/event/RequestEnd.java | 38 - .../tuscany/core/component/event/RequestEvent.java | 28 - .../tuscany/core/component/event/RequestStart.java | 37 - .../component/scope/AbstractScopeContainer.java | 265 ---- .../component/scope/CompositeScopeContainer.java | 114 -- .../scope/ConversationalScopeContainer.java | 190 --- .../component/scope/HttpSessionScopeContainer.java | 141 --- .../core/component/scope/InstanceWrapperBase.java | 53 - .../component/scope/RequestScopeContainer.java | 130 -- .../core/component/scope/ScopeRegistryImpl.java | 49 - .../component/scope/StatelessScopeContainer.java | 62 - .../core/deployer/AbstractDeploymentContext.java | 80 -- .../core/deployer/ChildDeploymentContext.java | 71 -- .../apache/tuscany/core/deployer/DeployerImpl.java | 197 --- .../core/deployer/RootDeploymentContext.java | 74 -- .../core/implementation/PojoWorkContextTunnel.java | 63 - .../composite/AbstractCompositeBuilder.java | 69 -- .../composite/ComponentTimeoutException.java | 33 - .../implementation/composite/CompositeBuilder.java | 51 - .../composite/CompositeComponentImpl.java | 121 -- .../composite/CompositeComponentTypeLoader.java | 65 - .../implementation/composite/CompositeLoader.java | 224 ---- .../composite/ManagedRequestContext.java | 58 - .../implementation/composite/ReferenceImpl.java | 71 -- .../core/implementation/composite/ServiceImpl.java | 81 -- .../core/injection/SingletonObjectFactory.java | 39 - .../tuscany/core/loader/ComponentLoader.java | 360 ------ .../core/loader/ComponentTypeElementLoader.java | 86 -- .../apache/tuscany/core/loader/IncludeLoader.java | 105 -- .../core/loader/LoaderExceptionFormatter.java | 67 - .../tuscany/core/loader/LoaderRegistryImpl.java | 179 --- .../tuscany/core/loader/PolicySetLoader.java | 195 --- .../apache/tuscany/core/loader/PropertyLoader.java | 98 -- .../apache/tuscany/core/loader/PropertyUtils.java | 119 -- .../tuscany/core/loader/ReferenceLoader.java | 107 -- .../apache/tuscany/core/loader/ServiceLoader.java | 99 -- .../core/loader/StringParserPropertyFactory.java | 191 --- .../org/apache/tuscany/core/loader/WireLoader.java | 122 -- .../core/monitor/DefaultExceptionFormatter.java | 54 - .../core/monitor/InvalidLevelException.java | 64 - .../core/monitor/JavaLoggingMonitorFactory.java | 120 -- .../tuscany/core/monitor/MonitorFactoryUtil.java | 78 -- .../tuscany/core/monitor/NullMonitorFactory.java | 68 -- .../tuscany/core/monitor/ProxyMonitorFactory.java | 234 ---- .../tuscany/core/resolver/AutowireResolver.java | 64 - .../resolver/AutowireTargetNotFoundException.java | 30 - .../core/resolver/DefaultAutowireResolver.java | 181 --- .../tuscany/core/runtime/AbstractRuntime.java | 379 ------ .../classloading/ClassLoaderRegistryImpl.java | 50 - .../core/services/store/memory/MemoryStore.java | 198 --- .../org/apache/tuscany/core/util/FileHelper.java | 704 ----------- .../org/apache/tuscany/core/util/IOHelper.java | 182 --- .../tuscany/core/util/JavaIntrospectionHelper.java | 439 ------- .../core/wire/CallbackInterfaceInterceptor.java | 60 - ...ompatibleServiceContractExceptionFormatter.java | 94 -- .../tuscany/core/wire/InvocationChainImpl.java | 105 -- .../tuscany/core/wire/InvokerInterceptor.java | 60 - .../core/wire/NoMethodForOperationException.java | 42 - .../tuscany/core/wire/NonBlockingInterceptor.java | 193 --- .../core/wire/NonBlockingInterceptorBuilder.java | 55 - .../core/wire/OptimizedWireObjectFactory.java | 49 - .../tuscany/core/wire/ProxyServiceExtension.java | 115 -- .../org/apache/tuscany/core/wire/WireImpl.java | 159 --- .../tuscany/core/wire/WireObjectFactory.java | 85 -- .../tuscany/core/wire/WireObjectFactory2.java | 65 - .../org/apache/tuscany/core/wire/WireUtils.java | 116 -- .../org/apache/tuscany/core/composite.scdl | 48 - .../org/apache/tuscany/core/deployment.scdl | 62 - .../org/apache/tuscany/core/formatters.scdl | 44 - .../org/apache/tuscany/core/implementation.scdl | 79 -- .../org/apache/tuscany/core/interfaceJava.scdl | 36 - .../apache/tuscany/core/javaImplementation.scdl | 40 - .../resources/org/apache/tuscany/core/loader.scdl | 53 - .../apache/tuscany/core/systemImplementation.scdl | 51 - .../local/AbstractLocalTargetInvokerTestCase.java | 72 -- .../binding/local/LocalBindingBuilderTestCase.java | 40 - .../binding/local/LocalBindingLoaderTestCase.java | 70 -- ...ckTargetInvokerInvocationExceptionTestCase.java | 84 -- .../local/LocalCallbackTargetInvokerTestCase.java | 83 -- ...ocalCallbackTargetInvokerThrowableTestCase.java | 89 -- .../binding/local/LocalTargetInvokerTestCase.java | 115 -- .../builder/BuilderRegistryNoBindingsTestCase.java | 89 -- .../core/builder/BuilderRegistryTestCase.java | 190 --- .../core/builder/ConnectorImplTestCase.java | 320 ----- .../builder/IllegalCallbackExceptionTestCase.java | 40 - .../IncompatibleInterfacesExceptionTestCase.java | 38 - .../InvalidSourceTypeExceptionTestCase.java | 39 - .../InvalidTargetTypeExceptionTestCase.java | 39 - .../TargetServiceNotFoundExceptionTestCase.java | 38 - .../WirePostProcessorRegistryImplTestCase.java | 48 - .../builder/WiringExceptionFormatterTestCase.java | 70 -- .../component/ComponentManagerImplTestCase.java | 90 -- .../component/JavaObjectRegistrationTestCase.java | 77 -- .../SystemSingletonAtomicComponentTestCase.java | 82 -- .../core/component/event/EventTestCase.java | 69 -- .../scope/AbstractScopeContainerTestCase.java | 61 - .../scope/BasicCompositeScopeTestCase.java | 143 --- .../scope/BasicConversationalScopeTestCase.java | 95 -- .../scope/BasicHttpSessionScopeTestCase.java | 220 ---- .../component/scope/BasicRequestScopeTestCase.java | 167 --- .../scope/BasicStatelessScopeTestCase.java | 89 -- .../CompositeScopeInitDestroyErrorTestCase.java | 93 -- ...lScopeContainerDestroyOnExpirationTestCase.java | 72 -- ...ConversationalScopeContainerMaxAgeTestCase.java | 76 -- ...rsationalScopeContainerMaxIdleTimeTestCase.java | 78 -- ...rsationalScopeContainerPersistenceTestCase.java | 189 --- .../scope/InstanceWrapperBaseTestCase.java | 64 - .../core/component/scope/WorkContextTestCase.java | 166 --- .../composite/CompositeComponentImplTestCase.java | 79 -- .../composite/DuplicateRegistrationTestCase.java | 120 -- .../composite/ManagedRequestContextTestCase.java | 42 - .../composite/ReferenceImplTestCase.java | 55 - .../composite/ServiceImplTestCase.java | 56 - .../injection/SingletonObjectFactoryTestCase.java | 33 - .../tuscany/core/mock/component/AsyncTarget.java | 31 - .../core/mock/component/BadContextPojo.java | 28 - .../tuscany/core/mock/component/BadNamePojo.java | 26 - .../core/mock/component/BasicInterface.java | 30 - .../core/mock/component/BasicInterfaceImpl.java | 66 - .../mock/component/CompositeScopeComponent.java | 31 - .../component/CompositeScopeComponentImpl.java | 40 - .../CompositeScopeDestroyOnlyComponent.java | 36 - .../CompositeScopeInitDestroyComponent.java | 39 - .../component/CompositeScopeInitOnlyComponent.java | 42 - .../component/ConversationalScopeComponent.java | 29 - .../ConversationalScopeComponentImpl.java | 29 - .../ConversationalScopeDestroyOnlyComponent.java | 37 - .../ConversationalScopeInitDestroyComponent.java | 38 - .../ConversationalScopeInitOnlyComponent.java | 38 - .../core/mock/component/OrderException.java | 40 - .../core/mock/component/OrderedDependentPojo.java | 29 - .../mock/component/OrderedDependentPojoImpl.java | 36 - .../core/mock/component/OrderedEagerInitPojo.java | 60 - .../core/mock/component/OrderedInitPojo.java | 28 - .../core/mock/component/OrderedInitPojoImpl.java | 61 - .../tuscany/core/mock/component/OtherTarget.java | 31 - .../core/mock/component/OtherTargetImpl.java | 39 - .../core/mock/component/RequestScopeComponent.java | 30 - .../RequestScopeDestroyOnlyComponent.java | 38 - .../RequestScopeInitDestroyComponent.java | 38 - .../component/RequestScopeInitOnlyComponent.java | 39 - .../core/mock/component/SessionScopeComponent.java | 30 - .../mock/component/SessionScopeComponentImpl.java | 30 - .../SessionScopeInitDestroyComponent.java | 36 - .../component/SessionScopeInitOnlyComponent.java | 37 - .../tuscany/core/mock/component/SimpleTarget.java | 30 - .../core/mock/component/SimpleTargetImpl.java | 41 - .../apache/tuscany/core/mock/component/Source.java | 37 - .../tuscany/core/mock/component/SourceImpl.java | 63 - .../core/mock/component/StatelessComponent.java | 30 - .../mock/component/StatelessComponentImpl.java | 27 - .../apache/tuscany/core/mock/component/Target.java | 32 - .../tuscany/core/mock/component/TargetImpl.java | 38 - .../tuscany/core/mock/wire/MockStaticInvoker.java | 98 -- .../core/mock/wire/MockSyncInterceptor.java | 55 - .../tuscany/core/mock/wire/MockTargetInvoker.java | 33 - .../monitor/DefaultExceptionFormatterTestCase.java | 59 - .../tuscany/core/monitor/JavaLoggingTestCase.java | 153 --- .../resolver/DefaultAutowireResolverTestCase.java | 177 --- .../services/store/memory/MemoryStoreTestCase.java | 166 --- .../java/org/apache/tuscany/core/util/Bean1.java | 45 - .../java/org/apache/tuscany/core/util/Bean2.java | 47 - .../core/util/JavaIntrospectionHelperTestCase.java | 180 --- .../org/apache/tuscany/core/util/SuperBean.java | 48 - .../wire/CallbackInterfaceInterceptorTestCase.java | 60 - .../core/wire/ContractCompatibilityTestCase.java | 390 ------ ...eServiceContractExceptionFormatterTestCase.java | 82 -- .../core/wire/InvocationChainImplTestCase.java | 84 -- .../NonBlockingInterceptorBuilderTestCase.java | 38 - .../core/wire/NonBlockingInterceptorTestCase.java | 75 -- .../wire/OptimizedWireObjectFactoryTestCase.java | 44 - .../apache/tuscany/core/wire/WireImplTestCase.java | 50 - .../core/wire/WireObjectFactoryTestCase.java | 138 --- .../core/wire/WireOptimizationTestCase.java | 113 -- .../tuscany/core/wire/WireUtilsTestCase.java | 69 -- .../resources/deployables/sample-calculator.jar | Bin 26901 -> 0 bytes .../src/test/resources/marshall/javaChangeSet.xml | 72 -- .../tuscany/core/deployer/boot1-include.scdl | 32 - .../org/apache/tuscany/core/deployer/boot1.scdl | 34 - .../org/apache/tuscany/core/deployer/boot2.scdl | 160 --- .../org/apache/tuscany/core/loader/TestPolicy.scdl | 51 - .../apache/tuscany/core/loader/test-include.scdl | 22 - .../org/apache/tuscany/core/policy/PolicySet.scdl | 66 - .../org/apache/tuscany/core/property/ipo.xml | 51 - .../tuscany/core/services/deployment/test.ext | 18 - .../tuscany/core/services/deployment/test.scdl | 22 - .../resources/repository/sample-calculator.jar | Bin 26901 -> 0 bytes sandbox/rfeng/runtime/embedded/.checkstyle | 24 - sandbox/rfeng/runtime/embedded/.pmd | 20 - sandbox/rfeng/runtime/embedded/.ruleset | 190 --- sandbox/rfeng/runtime/embedded/LICENSE.txt | 202 ---- sandbox/rfeng/runtime/embedded/NOTICE.txt | 14 - sandbox/rfeng/runtime/embedded/pom.xml | 47 - .../java/org/apache/tuscany/api/SCARuntime.java | 249 ---- .../runtime/embedded/DefaultSCARuntime.java | 75 -- .../tuscany/runtime/embedded/SimpleRuntime.java | 48 - .../runtime/embedded/SimpleRuntimeImpl.java | 136 --- .../runtime/embedded/SimpleRuntimeInfo.java | 56 - .../runtime/embedded/SimpleRuntimeInfoImpl.java | 182 --- .../src/test/java/calculator/AddService.java | 25 - .../src/test/java/calculator/AddServiceImpl.java | 30 - .../src/test/java/calculator/CalculatorClient.java | 51 - .../test/java/calculator/CalculatorService.java | 35 - .../java/calculator/CalculatorServiceImpl.java | 70 -- .../src/test/java/calculator/DivideService.java | 25 - .../test/java/calculator/DivideServiceImpl.java | 30 - .../src/test/java/calculator/MultiplyService.java | 25 - .../test/java/calculator/MultiplyServiceImpl.java | 30 - .../src/test/java/calculator/SubtractService.java | 25 - .../test/java/calculator/SubtractServiceImpl.java | 30 - .../org/apache/tuscany/api/SCARuntimeTestCase.java | 57 - .../embedded/SimpleRuntimeImplTestCase.java | 60 - .../src/test/resources/application.composite | 46 - .../embedded/src/test/resources/system.composite | 349 ------ sandbox/rfeng/samples.M2/creditws-axis2/.classpath | 45 - sandbox/rfeng/samples.M2/creditws-axis2/.project | 17 - sandbox/rfeng/samples.M2/creditws-axis2/build.xml | 109 -- .../build/lib/CreditCheckService.aar | Bin 15388 -> 0 bytes .../resources/CreditCheckService.wsdl | 71 -- .../creditws-axis2/resources/services.xml | 14 - .../CreditCheckServiceMessageReceiverInOut.java | 144 --- .../src/credit/CreditCheckServiceSkeleton.java | 29 - .../creditws-axis2/src/credit/ExtensionMapper.java | 24 - .../creditws-axis2/src/credit/GetCreditScore.java | 301 ----- .../src/credit/GetCreditScoreResponse.java | 290 ----- .../samples.M2/creditws-axis2/wsdl/credit.wsdl | 81 -- sandbox/rfeng/samples.M2/creditws/.ruleset | 172 --- sandbox/rfeng/samples.M2/creditws/pom.xml | 102 -- .../creditws/src/main/java/credit/CreditCheck.java | 26 - .../src/main/java/credit/CreditCheckImpl.java | 34 - .../src/main/resources/META-INF/LICENSE.txt | 1277 -------------------- .../creditws/src/main/resources/META-INF/NOTICE | 18 - .../src/main/resources/META-INF/README.txt | 35 - .../creditws/src/main/resources/wsdl/credit.wsdl | 81 -- .../src/main/webapp/META-INF/tuscany/webapp.scdl | 139 --- .../creditws/src/main/webapp/WEB-INF/default.scdl | 35 - .../creditws/src/main/webapp/WEB-INF/web.xml | 41 - sandbox/rfeng/samples.M2/mortgage/pom.xml | 79 -- .../src/main/java/mortgage/CreditCheck.java | 29 - .../src/main/java/mortgage/CreditCheckImpl.java | 32 - .../mortgage/src/main/java/mortgage/Customer.java | 75 -- .../src/main/java/mortgage/InterestRateQuote.java | 23 - .../main/java/mortgage/InterestRateQuoteImpl.java | 31 - .../src/main/java/mortgage/LoanApproval.java | 27 - .../src/main/java/mortgage/LoanApprovalImpl.java | 78 -- .../src/main/java/mortgage/MortgageCalculator.java | 29 - .../main/java/mortgage/MortgageCalculatorImpl.java | 37 - .../src/main/java/mortgage/MortgageClient.java | 43 - .../src/main/java/mortgage/RiskAssessment.java | 27 - .../src/main/java/mortgage/RiskAssessmentImpl.java | 37 - .../src/main/resources/META-INF/LICENSE.txt | 1277 -------------------- .../mortgage/src/main/resources/META-INF/NOTICE | 18 - .../src/main/resources/META-INF/sca/default.scdl | 47 - .../src/main/resources/META-INF/sca/default1.scdl | 50 - .../src/main/resources/META-INF/sca/default2.scdl | 50 - .../resources/MortgageCalculator.componentType | 27 - .../src/main/resources/MortgageCalculator.js | 25 - .../src/main/resources/doc/credit_composite.jpg | Bin 73610 -> 0 bytes .../src/main/resources/doc/credit_composite.png | Bin 51153 -> 0 bytes .../src/main/resources/doc/loan_approval.jpg | Bin 162536 -> 0 bytes .../src/main/resources/doc/loan_approval.png | Bin 58247 -> 0 bytes .../src/main/resources/doc/mortgage_assembly0.jpg | Bin 145053 -> 0 bytes .../src/main/resources/doc/mortgage_assembly0.png | Bin 93773 -> 0 bytes .../src/main/resources/doc/mortgage_assembly1.jpg | Bin 181317 -> 0 bytes .../src/main/resources/doc/mortgage_assembly1.png | Bin 113404 -> 0 bytes .../src/main/resources/doc/mortgage_assembly2.jpg | Bin 180240 -> 0 bytes .../src/main/resources/doc/mortgage_assembly2.png | Bin 106656 -> 0 bytes .../src/main/resources/doc/mortgage_composite.jpg | Bin 343699 -> 0 bytes .../src/main/resources/doc/mortgage_composite.png | Bin 288351 -> 0 bytes .../src/main/resources/doc/mortgage_diagrams.doc | Bin 2278400 -> 0 bytes .../src/main/resources/doc/mortgage_package1.jpg | Bin 181031 -> 0 bytes .../src/main/resources/doc/mortgage_package1.png | Bin 34939 -> 0 bytes .../src/main/resources/doc/mortgage_package2.jpg | Bin 110930 -> 0 bytes .../src/main/resources/doc/mortgage_package2.png | Bin 58993 -> 0 bytes .../src/main/resources/doc/mortgage_scenario.jpg | Bin 185793 -> 0 bytes .../src/main/resources/doc/mortgage_scenario.png | Bin 106791 -> 0 bytes .../mortgage/src/main/resources/doc/readme.html | 136 --- .../mortgage/src/main/resources/wsdl/credit.wsdl | 84 -- .../test/java/mortgage/MortgageClientTestCase.java | 61 - sandbox/rfeng/samples/calculatorws/.ruleset | 172 --- sandbox/rfeng/samples/calculatorws/pom.xml | 130 -- .../src/main/java/calculator/AddService.java | 25 - .../src/main/java/calculator/AddServiceImpl.java | 33 - .../src/main/java/calculator/CalculatorClient.java | 42 - .../main/java/calculator/CalculatorService.java | 38 - .../java/calculator/CalculatorServiceImpl.java | 72 -- .../src/main/java/calculator/DivideService.java | 25 - .../main/java/calculator/DivideServiceImpl.java | 33 - .../src/main/java/calculator/MultiplyService.java | 25 - .../main/java/calculator/MultiplyServiceImpl.java | 33 - .../src/main/java/calculator/SubtractService.java | 25 - .../main/java/calculator/SubtractServiceImpl.java | 33 - .../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/wsdl/calculator.wsdl | 155 --- .../src/main/webapp/META-INF/sca/default.scdl | 57 - .../webapp/META-INF/tuscany/binding.axis2.scdl | 44 - .../webapp/META-INF/tuscany/databinding.axiom.scdl | 48 - .../webapp/META-INF/tuscany/databinding.sdo.scdl | 60 - .../webapp/META-INF/tuscany/interface.wsdl.scdl | 44 - .../src/main/webapp/META-INF/tuscany/webapp.scdl | 138 --- .../calculatorws/src/main/webapp/WEB-INF/web.xml | 51 - sandbox/rfeng/samples/creditws/.ruleset | 172 --- sandbox/rfeng/samples/creditws/pom.xml | 103 -- .../creditws/src/main/java/credit/CreditCheck.java | 26 - .../src/main/java/credit/CreditCheckImpl.java | 34 - .../src/main/resources/META-INF/LICENSE.txt | 1277 -------------------- .../creditws/src/main/resources/META-INF/NOTICE | 18 - .../src/main/resources/META-INF/README.txt | 35 - .../creditws/src/main/resources/wsdl/credit.wsdl | 81 -- .../src/main/webapp/META-INF/tuscany/webapp.scdl | 139 --- .../creditws/src/main/webapp/WEB-INF/default.scdl | 35 - .../creditws/src/main/webapp/WEB-INF/web.xml | 41 - sandbox/rfeng/samples/echo.databinding/.ruleset | 190 --- sandbox/rfeng/samples/echo.databinding/NOTICE.txt | 14 - sandbox/rfeng/samples/echo.databinding/pom.xml | 112 -- .../main/resources/META-INF/sca/binding.echo.scdl | 31 - .../src/test/java/echo/ComponentAImpl.java | 94 -- .../src/test/java/echo/ComponentBImpl.java | 59 - .../src/test/java/echo/DataBindingITest.java | 51 - .../echo.databinding/src/test/java/echo/Echo.java | 32 - .../src/test/java/echo/Interface1.java | 32 - .../src/test/java/echo/Interface2.java | 36 - .../src/test/resources/wsdl/echo.wsdl | 45 - sandbox/rfeng/samples/mortgage/pom.xml | 142 --- .../src/main/java/mortgage/CreditCheck.java | 29 - .../src/main/java/mortgage/CreditCheckImpl.java | 32 - .../mortgage/src/main/java/mortgage/Customer.java | 75 -- .../src/main/java/mortgage/InterestRateQuote.java | 23 - .../main/java/mortgage/InterestRateQuoteImpl.java | 31 - .../src/main/java/mortgage/LoanApproval.java | 27 - .../src/main/java/mortgage/LoanApprovalImpl.java | 72 -- .../src/main/java/mortgage/MortgageCalculator.java | 29 - .../main/java/mortgage/MortgageCalculatorImpl.java | 37 - .../src/main/java/mortgage/MortgageClient.java | 46 - .../src/main/java/mortgage/RiskAssessment.java | 27 - .../src/main/java/mortgage/RiskAssessmentImpl.java | 37 - .../src/main/resources/META-INF/LICENSE.txt | 1277 -------------------- .../mortgage/src/main/resources/META-INF/NOTICE | 18 - .../src/main/resources/META-INF/sca/default.scdl | 48 - .../src/main/resources/META-INF/sca/default1.scdl | 50 - .../src/main/resources/META-INF/sca/default2.scdl | 50 - .../resources/MortgageCalculator.componentType | 27 - .../src/main/resources/MortgageCalculator.js | 25 - .../src/main/resources/doc/credit_composite.jpg | Bin 73610 -> 0 bytes .../src/main/resources/doc/credit_composite.png | Bin 51153 -> 0 bytes .../src/main/resources/doc/loan_approval.jpg | Bin 162536 -> 0 bytes .../src/main/resources/doc/loan_approval.png | Bin 58247 -> 0 bytes .../src/main/resources/doc/mortgage_assembly0.jpg | Bin 145053 -> 0 bytes .../src/main/resources/doc/mortgage_assembly0.png | Bin 93773 -> 0 bytes .../src/main/resources/doc/mortgage_assembly1.jpg | Bin 181317 -> 0 bytes .../src/main/resources/doc/mortgage_assembly1.png | Bin 113404 -> 0 bytes .../src/main/resources/doc/mortgage_assembly2.jpg | Bin 180240 -> 0 bytes .../src/main/resources/doc/mortgage_assembly2.png | Bin 106656 -> 0 bytes .../src/main/resources/doc/mortgage_composite.jpg | Bin 343699 -> 0 bytes .../src/main/resources/doc/mortgage_composite.png | Bin 288351 -> 0 bytes .../src/main/resources/doc/mortgage_diagrams.doc | Bin 2278400 -> 0 bytes .../src/main/resources/doc/mortgage_package1.jpg | Bin 181031 -> 0 bytes .../src/main/resources/doc/mortgage_package1.png | Bin 34939 -> 0 bytes .../src/main/resources/doc/mortgage_package2.jpg | Bin 110930 -> 0 bytes .../src/main/resources/doc/mortgage_package2.png | Bin 58993 -> 0 bytes .../src/main/resources/doc/mortgage_scenario.jpg | Bin 225690 -> 0 bytes .../src/main/resources/doc/mortgage_scenario.png | Bin 106791 -> 0 bytes .../mortgage/src/main/resources/doc/readme.html | 136 --- .../mortgage/src/main/resources/wsdl/credit.wsdl | 84 -- .../test/java/mortgage/MortgageClientTestCase.java | 61 - sandbox/rfeng/samples/pom.xml | 38 - 424 files changed, 35553 deletions(-) delete mode 100644 sandbox/rfeng/minicore/.checkstyle delete mode 100644 sandbox/rfeng/minicore/.pmd delete mode 100644 sandbox/rfeng/minicore/.ruleset delete mode 100644 sandbox/rfeng/minicore/LICENSE.txt delete mode 100644 sandbox/rfeng/minicore/NOTICE.txt delete mode 100644 sandbox/rfeng/minicore/pom.xml delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/ExtensionActivator.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ComponentNotFoundException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WireCreationException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallableReferenceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallbackReferenceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextProvider.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentManagerImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SimpleWorkContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStart.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStop.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/PojoWorkContextTunnel.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyUtils.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/WireLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/ProxyMonitorFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireResolver.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireTargetNotFoundException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/DefaultAutowireResolver.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/classloading/ClassLoaderRegistryImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/FileHelper.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/IOHelper.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptor.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/ProxyServiceExtension.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory2.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireUtils.java delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/composite.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/deployment.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/formatters.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/implementation.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/loader.scdl delete mode 100644 sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidSourceTypeExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/ComponentManagerImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/JavaObjectRegistrationTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponentTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperBaseTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Source.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Target.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/resolver/DefaultAutowireResolverTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean1.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean2.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/SuperBean.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java delete mode 100644 sandbox/rfeng/minicore/src/test/resources/deployables/sample-calculator.jar delete mode 100644 sandbox/rfeng/minicore/src/test/resources/marshall/javaChangeSet.xml delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/property/ipo.xml delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext delete mode 100644 sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl delete mode 100644 sandbox/rfeng/minicore/src/test/resources/repository/sample-calculator.jar delete mode 100644 sandbox/rfeng/runtime/embedded/.checkstyle delete mode 100644 sandbox/rfeng/runtime/embedded/.pmd delete mode 100644 sandbox/rfeng/runtime/embedded/.ruleset delete mode 100644 sandbox/rfeng/runtime/embedded/LICENSE.txt delete mode 100644 sandbox/rfeng/runtime/embedded/NOTICE.txt delete mode 100644 sandbox/rfeng/runtime/embedded/pom.xml delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/resources/application.composite delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/resources/system.composite delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/.classpath delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/.project delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/build.xml delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/build/lib/CreditCheckService.aar delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/resources/CreditCheckService.wsdl delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/resources/services.xml delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceMessageReceiverInOut.java delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceSkeleton.java delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/src/credit/ExtensionMapper.java delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScore.java delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScoreResponse.java delete mode 100644 sandbox/rfeng/samples.M2/creditws-axis2/wsdl/credit.wsdl delete mode 100644 sandbox/rfeng/samples.M2/creditws/.ruleset delete mode 100644 sandbox/rfeng/samples.M2/creditws/pom.xml delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheck.java delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheckImpl.java delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/LICENSE.txt delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/NOTICE delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/README.txt delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/resources/wsdl/credit.wsdl delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/default.scdl delete mode 100644 sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/web.xml delete mode 100644 sandbox/rfeng/samples.M2/mortgage/pom.xml delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheck.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheckImpl.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/Customer.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuote.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApproval.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApprovalImpl.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculator.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageClient.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessment.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/LICENSE.txt delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/NOTICE delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default.scdl delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default1.scdl delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default2.scdl delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.componentType delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.js delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_diagrams.doc delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.jpg delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.png delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/readme.html delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/main/resources/wsdl/credit.wsdl delete mode 100644 sandbox/rfeng/samples.M2/mortgage/src/test/java/mortgage/MortgageClientTestCase.java delete mode 100644 sandbox/rfeng/samples/calculatorws/.ruleset delete mode 100644 sandbox/rfeng/samples/calculatorws/pom.xml delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddService.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddServiceImpl.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorClient.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorService.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideService.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyService.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractService.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/LICENSE.txt delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/NOTICE delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/README.txt delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/resources/wsdl/calculator.wsdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/sca/default.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/webapp.scdl delete mode 100644 sandbox/rfeng/samples/calculatorws/src/main/webapp/WEB-INF/web.xml delete mode 100644 sandbox/rfeng/samples/creditws/.ruleset delete mode 100644 sandbox/rfeng/samples/creditws/pom.xml delete mode 100644 sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheck.java delete mode 100644 sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheckImpl.java delete mode 100644 sandbox/rfeng/samples/creditws/src/main/resources/META-INF/LICENSE.txt delete mode 100644 sandbox/rfeng/samples/creditws/src/main/resources/META-INF/NOTICE delete mode 100644 sandbox/rfeng/samples/creditws/src/main/resources/META-INF/README.txt delete mode 100644 sandbox/rfeng/samples/creditws/src/main/resources/wsdl/credit.wsdl delete mode 100644 sandbox/rfeng/samples/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl delete mode 100644 sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/default.scdl delete mode 100644 sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/web.xml delete mode 100644 sandbox/rfeng/samples/echo.databinding/.ruleset delete mode 100644 sandbox/rfeng/samples/echo.databinding/NOTICE.txt delete mode 100644 sandbox/rfeng/samples/echo.databinding/pom.xml delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/main/resources/META-INF/sca/binding.echo.scdl delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentAImpl.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentBImpl.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/DataBindingITest.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Echo.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface1.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface2.java delete mode 100644 sandbox/rfeng/samples/echo.databinding/src/test/resources/wsdl/echo.wsdl delete mode 100644 sandbox/rfeng/samples/mortgage/pom.xml delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheck.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheckImpl.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/Customer.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuote.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApproval.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApprovalImpl.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculator.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageClient.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessment.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/LICENSE.txt delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/NOTICE delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default1.scdl delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default2.scdl delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_diagrams.doc delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.jpg delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.png delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/doc/readme.html delete mode 100644 sandbox/rfeng/samples/mortgage/src/main/resources/wsdl/credit.wsdl delete mode 100644 sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java delete mode 100644 sandbox/rfeng/samples/pom.xml (limited to 'sandbox/rfeng') diff --git a/sandbox/rfeng/minicore/.checkstyle b/sandbox/rfeng/minicore/.checkstyle deleted file mode 100644 index 3e57539570..0000000000 --- a/sandbox/rfeng/minicore/.checkstyle +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/sandbox/rfeng/minicore/.pmd b/sandbox/rfeng/minicore/.pmd deleted file mode 100644 index ffc4fe2bbb..0000000000 --- a/sandbox/rfeng/minicore/.pmd +++ /dev/null @@ -1,20 +0,0 @@ - - -true diff --git a/sandbox/rfeng/minicore/.ruleset b/sandbox/rfeng/minicore/.ruleset deleted file mode 100644 index ba9b5ce886..0000000000 --- a/sandbox/rfeng/minicore/.ruleset +++ /dev/null @@ -1,190 +0,0 @@ - - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/LICENSE.txt b/sandbox/rfeng/minicore/LICENSE.txt deleted file mode 100644 index 0084319535..0000000000 --- a/sandbox/rfeng/minicore/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, serviceDefinition 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. diff --git a/sandbox/rfeng/minicore/NOTICE.txt b/sandbox/rfeng/minicore/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/sandbox/rfeng/minicore/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/rfeng/minicore/pom.xml b/sandbox/rfeng/minicore/pom.xml deleted file mode 100644 index eb0895a4b8..0000000000 --- a/sandbox/rfeng/minicore/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - org.apache.tuscany.sca - kernel - 2.0-alpha2-incubating-SNAPSHOT - - 4.0.0 - org.apache.tuscany.sca.kernel - tuscany-minicore - jar - Apache Tuscany SCA Core - Core Tuscany runtime. - - - - org.apache.tuscany.sca.kernel - tuscany-spi - ${project.version} - compile - - - - org.codehaus.woodstox - wstx-asl - - - - junit - junit - - - - org.easymock - easymockclassextension - - - - - - - src/main/resources - true - - - ${notice.dir} - META-INF - true - - LICENSE.txt - NOTICE.txt - - - - - diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java deleted file mode 100644 index 4a06bc8c74..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.component.WorkContext; - -/** - * Base class for dispatching to a composite reference using the local binding - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractLocalTargetInvoker implements TargetInvoker { - protected boolean cacheable; - - public boolean isCacheable() { - return cacheable; - } - - public void setCacheable(boolean cacheable) { - this.cacheable = cacheable; - } - - public boolean isOptimizable() { - return isCacheable(); // we only need to check if the scopes are correct - } - - public Object invokeTarget(final Object payload, short sequence, WorkContext workContext) throws InvocationTargetException { - throw new InvocationTargetException(new UnsupportedOperationException()); - } - - protected Message invoke(InvocationChain chain, TargetInvoker invoker, Message msg) throws Throwable { - Interceptor headInterceptor = chain.getHeadInterceptor(); - if (headInterceptor == null) { - try { - // short-circuit the dispatch and invoke the target directly - if (invoker == null) { - String name = chain.getOperation().getName(); - throw new AssertionError("No target invoker [" + name + "]"); - } - return invoker.invoke(msg); - } catch (InvocationRuntimeException e) { - // the cause was thrown by the target so throw it - throw e.getCause(); - } - } else { - msg.setTargetInvoker(invoker); - return headInterceptor.invoke(msg); - } - } - - @Override - public AbstractLocalTargetInvoker clone() throws CloneNotSupportedException { - return (AbstractLocalTargetInvoker) super.clone(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java deleted file mode 100644 index 63a9147b29..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.BindingBuilderExtension; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceDefinition; - -/** - * Creates runtime artifacts for the local binding - * - * @version $Rev$ $Date$ - */ -public class LocalBindingBuilder extends BindingBuilderExtension { - - protected Class getBindingType() { - return LocalBindingDefinition.class; - } - - public ServiceBinding build(ServiceDefinition serviceDefinition, - LocalBindingDefinition bindingDefinition, - DeploymentContext context) throws BuilderException { - return new LocalServiceBinding(serviceDefinition.getUri()); - } - - - public ReferenceBinding build(ReferenceDefinition referenceDefinition, - LocalBindingDefinition bindingDefinition, - DeploymentContext context) throws BuilderException { - return new LocalReferenceBinding(referenceDefinition.getUri(), bindingDefinition.getTargetUri()); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java deleted file mode 100644 index 9317a47457..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; - -import org.apache.tuscany.spi.model.BindingDefinition; - - -/** - * Represents the local by-reference binding - * - * @version $Rev$ $Date$ - */ -public class LocalBindingDefinition extends BindingDefinition { - - public LocalBindingDefinition() { - } - - public LocalBindingDefinition(URI targetUri) { - super(targetUri); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java deleted file mode 100644 index 3442f1ca4c..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; -import java.net.URISyntaxException; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Loader responsible for handling the local binding - * - * @version $Rev$ $Date$ - */ -public class LocalBindingLoader extends LoaderExtension { - - /** - * Constructor specifies the registry to register with. - * - * @param registry the LoaderRegistry this loader should register with - */ - public LocalBindingLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return Wire.LOCAL_BINDING; - } - - public LocalBindingDefinition load( - ModelObject object, - XMLStreamReader reader, - DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - String uri = reader.getAttributeValue(null, "uri"); - if (uri != null) { - try { - return new LocalBindingDefinition(new URI(uri)); - } catch (URISyntaxException e) { - throw new LoaderException(e); - } - } - return new LocalBindingDefinition(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java deleted file mode 100644 index c505ee99ab..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.util.Map; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Dispatches a callback invocation to the callback instance - * - * @version $Rev$ $Date$ - */ -public class LocalCallbackTargetInvoker extends AbstractLocalTargetInvoker { - private Operation operation; - private Wire wire; - - public LocalCallbackTargetInvoker(Operation operation, Wire wire) { - assert operation != null : "Operation method cannot be null"; - this.operation = operation; - this.wire = wire; - } - - public Message invoke(Message msg) throws InvocationRuntimeException { - try { - return invoke(operation, msg); - } catch (Throwable e) { - Message faultMsg = new MessageImpl(); - faultMsg.setBodyWithFault(e); - return faultMsg; - } - } - - private Message invoke(Operation operation, Message msg) throws Throwable { - //TODO optimize as this is slow in local invocations - Map, InvocationChain> chains = wire.getCallbackInvocationChains(); - InvocationChain chain = chains.get(operation); - TargetInvoker invoker = chain.getTargetInvoker(); - return invoke(chain, invoker, msg); - } - - @Override - public LocalCallbackTargetInvoker clone() throws CloneNotSupportedException { - return (LocalCallbackTargetInvoker) super.clone(); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java deleted file mode 100644 index b70df0e23a..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.CoreRuntimeException; -import org.apache.tuscany.spi.component.TargetInvokerCreationException; -import org.apache.tuscany.spi.extension.ReferenceBindingExtension; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * The runtime representaion of the local reference binding - * - * @version $Rev$ $Date$ - * @Deprecated - */ -public class LocalReferenceBinding extends ReferenceBindingExtension { - - public LocalReferenceBinding(URI name, URI targetUri) throws CoreRuntimeException { - super(name, targetUri); - } - - public QName getBindingType() { - return Wire.LOCAL_BINDING; - } - - public TargetInvoker createTargetInvoker(String name, Operation operation) - throws TargetInvokerCreationException { - if (operation.isCallback()) { - return new LocalCallbackTargetInvoker(operation, wire); - } else { - return new LocalTargetInvoker(operation, wire); - } - } - - public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) - throws TargetInvokerCreationException { - return null; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java deleted file mode 100644 index 543a0f53b4..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.CoreRuntimeException; -import org.apache.tuscany.spi.component.TargetInvokerCreationException; -import org.apache.tuscany.spi.extension.ServiceBindingExtension; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * The runtime representaion of the local service binding - * - * @version $Rev$ $Date$ - */ -public class LocalServiceBinding extends ServiceBindingExtension { - - public LocalServiceBinding(URI name) throws CoreRuntimeException { - super(name); - } - - public QName getBindingType() { - return Wire.LOCAL_BINDING; - } - - public TargetInvoker createTargetInvoker(String name, Operation operation) - throws TargetInvokerCreationException { - if (operation.isCallback()) { - return new LocalCallbackTargetInvoker(operation, getWire()); - } else { - return new LocalTargetInvoker(operation, getWire()); - } - } - - public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) - throws TargetInvokerCreationException { - return null; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java deleted file mode 100644 index b89a70a9e0..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.util.UriHelper; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Dispatches an invocation through a composite service or reference using the local binding - * - * @version $Rev$ $Date$ - */ -public class LocalTargetInvoker extends AbstractLocalTargetInvoker { - private InvocationChain chain; - private URI fromAddress; - private boolean contractHasCallback; - - public LocalTargetInvoker(Operation operation, Wire wire) { - assert operation != null; - chain = wire.getInvocationChains().get(operation); - assert chain != null; - if (wire.getSourceUri() != null) { - fromAddress = URI.create(UriHelper.getBaseName(wire.getSourceUri())); - } - contractHasCallback = !wire.getCallbackInvocationChains().isEmpty(); - } - - @Override - public LocalTargetInvoker clone() throws CloneNotSupportedException { - return (LocalTargetInvoker) super.clone(); - } - - public Message invoke(Message msg) throws InvocationRuntimeException { - try { - TargetInvoker invoker = chain.getTargetInvoker(); - assert invoker != null; - // Pushing the from address only needs to happen in the outbound (forward) direction for callbacks - if (contractHasCallback) { - //JFM do we need this? - msg.pushCallbackUri(fromAddress); - } - - return invoke(chain, invoker, msg); - } catch (Throwable e) { - Message faultMsg = new MessageImpl(); - faultMsg.setBodyWithFault(e); - return faultMsg; - } - } - - - public boolean isOptimizable() { - return true; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java deleted file mode 100644 index a52e8e2f83..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.bootstrap; - -import org.apache.tuscany.core.resolver.AutowireResolver; -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.deployer.Deployer; - -/** - * Interface that abstracts the process used to create a running Tuscany system. Implementation of this may provide - * different mechanisms for creating the primoridal system components used to boot the core to the level where it can - * support end-user applications. - * - * @version $Rev$ $Date$ - */ -public interface Bootstrapper { - /** - * Return the MonitorFactory being used by the implementation to provide monitor interfaces for the primordial - * components. - * - * @return the MonitorFactory being used by the bootstrapper - */ - MonitorFactory getMonitorFactory(); - - /** - * Create a Deployer that can be used to deploy the system definition. This will most likely only support a small - * subset of the available programming model. - * - * @return a new primordial Deployer - */ - Deployer createDeployer(); - - /** - * Create a ScopeRegistry that supports the Scopes supported for primordial components - * - * @return a new primordial ScopeRegistry - */ - ScopeRegistry getScopeRegistry(); - - /** - * Create a Connector that can wire together primordial components. - * - * @return a new primordial Connector - */ - Connector getConnector(); - - /** - * Returns the AutowireResolver that resolves autowire targets - * - * @return the AutowireResolver that resolves autowire targets - */ - AutowireResolver getAutowireResolver(); - - ComponentManager getComponentManager(); - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java deleted file mode 100644 index db6cba72f9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.bootstrap; - -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.core.binding.local.LocalBindingBuilder; -import org.apache.tuscany.core.binding.local.LocalBindingDefinition; -import org.apache.tuscany.core.binding.local.LocalBindingLoader; -import org.apache.tuscany.core.builder.BuilderRegistryImpl; -import org.apache.tuscany.core.component.scope.AbstractScopeContainer; -import org.apache.tuscany.core.component.scope.CompositeScopeContainer; -import org.apache.tuscany.core.component.scope.RequestScopeContainer; -import org.apache.tuscany.core.component.scope.ScopeRegistryImpl; -import org.apache.tuscany.core.component.scope.StatelessScopeContainer; -import org.apache.tuscany.core.deployer.DeployerImpl; -import org.apache.tuscany.core.implementation.composite.CompositeBuilder; -import org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader; -import org.apache.tuscany.core.implementation.composite.CompositeLoader; -import org.apache.tuscany.core.loader.ComponentLoader; -import org.apache.tuscany.core.loader.ComponentTypeElementLoader; -import org.apache.tuscany.core.loader.IncludeLoader; -import org.apache.tuscany.core.loader.LoaderRegistryImpl; -import org.apache.tuscany.core.loader.PropertyLoader; -import org.apache.tuscany.core.loader.ReferenceLoader; -import org.apache.tuscany.core.loader.ServiceLoader; -import org.apache.tuscany.core.resolver.AutowireResolver; -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.spi.builder.Builder; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.deployer.Deployer; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.implementation.java.Introspector; -import org.apache.tuscany.spi.loader.Loader; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.PropertyObjectFactory; -import org.apache.tuscany.spi.model.CompositeImplementation; - -/** - * A default implementation of a Bootstrapper. Please see the documentation on - * the individual methods for how the primordial components are created. - * - * @version $Rev$ $Date$ - */ -public class DefaultBootstrapper implements Bootstrapper { - private final MonitorFactory monitorFactory; - private final XMLInputFactory xmlFactory; - private final ComponentManager componentManager; - private final AutowireResolver resolver; - private final Connector connector; - private final ScopeRegistry scopeRegistry; - - /** - * Create a default bootstrapper. - * - * @param monitorFactory the MonitorFactory to be used to create monitors - * for the primordial components - * @param xmlFactory the XMLInputFactory to be used by the components to - * load XML artifacts - * @param componentManager the component manager for the runtime instance - * @param resolver the autowire resolver for the runtime instance - * @param connector the connector for the runtime instance - */ - public DefaultBootstrapper(MonitorFactory monitorFactory, - XMLInputFactory xmlFactory, - ComponentManager componentManager, - AutowireResolver resolver, - Connector connector) { - this.monitorFactory = monitorFactory; - this.xmlFactory = xmlFactory; - this.componentManager = componentManager; - this.resolver = resolver; - this.connector = connector; - this.scopeRegistry = createScopeRegistry(); - } - - /** - * Returns the MonitorFactory being used by this bootstrapper. - * - * @return the MonitorFactory being used by this bootstrapper - */ - public MonitorFactory getMonitorFactory() { - return monitorFactory; - } - - /** - * Create primordial deployer that can be used to load the system - * definition. - * - * @return the primordial deployer - */ - public Deployer createDeployer() { - ScopeRegistry scopeRegistry = getScopeRegistry(); - Builder builder = createBuilder(scopeRegistry); - Loader loader = createLoader(null, null); - DeployerImpl deployer = new DeployerImpl(xmlFactory, loader, builder, componentManager, resolver, connector); - deployer.setMonitor(getMonitorFactory().getMonitor(ScopeContainerMonitor.class)); - deployer.setScopeRegistry(getScopeRegistry()); - return deployer; - } - - /** - * Create a basic ScopeRegistry containing the ScopeContainers that are - * available to components in the system definition. The implementation - * returned only support COMPOSITE scope. - * - * @return a new ScopeRegistry - */ - private ScopeRegistry createScopeRegistry() { - ScopeRegistry scopeRegistry = new ScopeRegistryImpl(); - ScopeContainerMonitor monitor = monitorFactory.getMonitor(ScopeContainerMonitor.class); - AbstractScopeContainer[] containers = new AbstractScopeContainer[] {new CompositeScopeContainer(monitor), - new StatelessScopeContainer(monitor), - new RequestScopeContainer(monitor), - // new ConversationalScopeContainer(monitor), - // new HttpSessionScopeContainer(monitor) - }; - for (AbstractScopeContainer c : containers) { - c.start(); - scopeRegistry.register(c); - } - - return scopeRegistry; - } - - /** - * Create a new Connector that can be used to wire primordial components - * together. - * - * @return a new Connector - */ - public Connector getConnector() { - return connector; - } - - public AutowireResolver getAutowireResolver() { - return resolver; - } - - /** - * Helper method for registering a loader with the registry. The Loader is - * registered once for the QName returned by its - * {@link LoaderExtension#getXMLType()} method. - * - * @param registry the LoaderRegistry to register with - * @param loader the Loader to register - */ - protected void registerLoader(LoaderRegistry registry, LoaderExtension loader) { - registry.registerLoader(loader.getXMLType(), loader); - } - - public LoaderRegistry createLoader(PropertyObjectFactory propertyFactory, Introspector introspector) { - LoaderRegistryImpl loaderRegistry = new LoaderRegistryImpl(monitorFactory - .getMonitor(LoaderRegistryImpl.Monitor.class)); - - // register element loaders - registerLoader(loaderRegistry, new ComponentLoader(loaderRegistry, propertyFactory)); - registerLoader(loaderRegistry, new ComponentTypeElementLoader(loaderRegistry)); - registerLoader(loaderRegistry, new CompositeLoader(loaderRegistry, null)); - registerLoader(loaderRegistry, new IncludeLoader(loaderRegistry)); - registerLoader(loaderRegistry, new PropertyLoader(loaderRegistry)); - registerLoader(loaderRegistry, new ReferenceLoader(loaderRegistry)); - registerLoader(loaderRegistry, new ServiceLoader(loaderRegistry)); - registerLoader(loaderRegistry, new LocalBindingLoader(loaderRegistry)); - - loaderRegistry.registerLoader(CompositeImplementation.class, new CompositeComponentTypeLoader(loaderRegistry)); - return loaderRegistry; - } - - /** - * Create a Builder that can be used to build the components in the system - * definition. The default implementation only supports implementations from - * the system programming model. - * - * @param scopeRegistry the ScopeRegistry defining the component scopes that - * will be supported - * @return a new Builder - */ - private Builder createBuilder(ScopeRegistry scopeRegistry) { - BuilderRegistryImpl builderRegistry = new BuilderRegistryImpl(scopeRegistry); - CompositeBuilder compositeBuilder = new CompositeBuilder(); - compositeBuilder.setBuilderRegistry(builderRegistry); - compositeBuilder.setScopeRegistry(scopeRegistry); - compositeBuilder.init(); - // builderRegistry.register(CompositeImplementation.class, - // compositeBuilder); - builderRegistry.register(LocalBindingDefinition.class, new LocalBindingBuilder()); - return builderRegistry; - } - - /** - * @return the componentManager - */ - public ComponentManager getComponentManager() { - return componentManager; - } - - /** - * @return the scopeRegistry - */ - public ScopeRegistry getScopeRegistry() { - return scopeRegistry; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/ExtensionActivator.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/ExtensionActivator.java deleted file mode 100644 index 92f526dd8b..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/bootstrap/ExtensionActivator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.core.bootstrap; - -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.loader.LoaderRegistry; - -/** - * @version $Rev$ $Date$ - */ -public interface ExtensionActivator { - void start(LoaderRegistry loaderRegistry, BuilderRegistry builderRegistry); - void stop(); -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java deleted file mode 100644 index 33dd2175f9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.osoa.sca.annotations.EagerInit; - -import org.apache.tuscany.spi.builder.BindingBuilder; -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.builder.ComponentBuilder; -import org.apache.tuscany.spi.builder.ScopeNotFoundException; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.model.BindingDefinition; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; - -import org.apache.tuscany.core.binding.local.LocalBindingDefinition; -import org.apache.tuscany.core.implementation.composite.ReferenceImpl; -import org.apache.tuscany.core.implementation.composite.ServiceImpl; - -/** - * The default builder registry in the runtime - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class BuilderRegistryImpl implements BuilderRegistry { - private ScopeRegistry scopeRegistry; - - private final Map>, ComponentBuilder>> componentBuilders = - new HashMap>, ComponentBuilder>>(); - private final Map, BindingBuilder> bindingBuilders = - new HashMap, BindingBuilder>(); - - public BuilderRegistryImpl(@org.osoa.sca.annotations.Reference ScopeRegistry scopeRegistry) { - this.scopeRegistry = scopeRegistry; - } - - public > void register(Class implClass, ComponentBuilder builder) { - componentBuilders.put(implClass, builder); - } - - public > void unregister(Class implClass) { - componentBuilders.remove(implClass); - } - - public void register(Class implClass, BindingBuilder builder) { - bindingBuilders.put(implClass, builder); - } - - @SuppressWarnings("unchecked") - public > Component build( - ComponentDefinition componentDefinition, - DeploymentContext context) throws BuilderException { - Class implClass = componentDefinition.getImplementation().getClass(); - // noinspection SuspiciousMethodCalls - ComponentBuilder componentBuilder = (ComponentBuilder) componentBuilders.get(implClass); - if (componentBuilder == null) { - String name = implClass.getName(); - throw new NoRegisteredBuilderException("No builder registered for implementation", name); - } - Component component = componentBuilder.build(componentDefinition, context); - assert component != null; - component.setDefaultPropertyValues(componentDefinition.getPropertyValues()); - Scope scope = componentDefinition.getImplementation().getComponentType().getImplementationScope(); - if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) { - component.setScopeContainer(context.getCompositeScope()); - } else { - // Check for conversational contract if conversational scope - if (scope == Scope.CONVERSATION) { - boolean hasConversationalContract = false; - ComponentType componentType = - componentDefinition.getImplementation().getComponentType(); - Map services = componentType.getServices(); - for (ServiceDefinition serviceDef : services.values()) { - ServiceContract contract = serviceDef.getServiceContract(); - if (contract.isConversational()) { - hasConversationalContract = true; - break; - } - } - if (!hasConversationalContract) { - String name = implClass.getName(); - throw new NoConversationalContractException( - "No conversational contract for conversational implementation", name); - } - } - // Now it's ok to set the scope container - ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(scope); - if (scopeContainer == null) { - throw new ScopeNotFoundException(scope.toString()); - } - component.setScopeContainer(scopeContainer); - } - context.getComponents().put(component.getUri(), component); - ComponentType componentType = componentDefinition.getImplementation().getComponentType(); - assert componentType != null : "Component type must be set"; - return component; - } - - @SuppressWarnings({"unchecked"}) - public Service build(ServiceDefinition serviceDefinition, DeploymentContext context) throws BuilderException { - URI uri = serviceDefinition.getUri(); - ServiceContract serviceContract = serviceDefinition.getServiceContract(); - if (serviceDefinition.getBindings().isEmpty()) { - // if no bindings are configured, default to the local binding. - // this should be changed to allow runtime selection - if (serviceDefinition.getBindings().isEmpty()) { - // TODO JFM implement capability for the runtime to choose a binding - serviceDefinition.addBinding(new LocalBindingDefinition()); - } - } - URI targetUri = serviceDefinition.getTarget(); - Service service = new ServiceImpl(uri, serviceContract, targetUri); - for (BindingDefinition definition : serviceDefinition.getBindings()) { - Class bindingClass = definition.getClass(); - // noinspection SuspiciousMethodCalls - BindingBuilder bindingBuilder = bindingBuilders.get(bindingClass); - if (bindingBuilder == null) { - throw new NoRegisteredBuilderException("No builder registered for type", bindingClass.getName()); - } - ServiceBinding binding = bindingBuilder.build(serviceDefinition, definition, context); - service.addServiceBinding(binding); - } - return service; - } - - @SuppressWarnings("unchecked") - public Reference build(ReferenceDefinition referenceDefinition, DeploymentContext context) throws BuilderException { - URI uri = referenceDefinition.getUri(); - ServiceContract contract = referenceDefinition.getServiceContract(); - if (referenceDefinition.getBindings().isEmpty()) { - // if no bindings are configured, default to the local binding. - // this should be changed to allow runtime selection - if (referenceDefinition.getBindings().isEmpty()) { - // TODO JFM implement capability for the runtime to choose a binding - referenceDefinition.addBinding(new LocalBindingDefinition()); - } - } - - Reference reference = new ReferenceImpl(uri, contract); - for (BindingDefinition bindingDefinition : referenceDefinition.getBindings()) { - Class bindingClass = bindingDefinition.getClass(); - // noinspection SuspiciousMethodCalls - BindingBuilder bindingBuilder = bindingBuilders.get(bindingClass); - ReferenceBinding binding = bindingBuilder.build(referenceDefinition, bindingDefinition, context); - reference.addReferenceBinding(binding); - - } - return reference; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ComponentNotFoundException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ComponentNotFoundException.java deleted file mode 100644 index a46e038cb9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ComponentNotFoundException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Indicates a component was not found during wiring - * - * @version $Rev$ $Date$ - */ -public class ComponentNotFoundException extends WiringException { - - public ComponentNotFoundException(String message, URI name) { - super(message, name, name); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java deleted file mode 100644 index 6923fb6837..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import javax.xml.namespace.QName; - -import org.osoa.sca.annotations.Constructor; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.builder.WiringException; -import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilderRegistry; -import org.apache.tuscany.spi.builder.physical.WireAttacherRegistry; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.Invocable; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.component.TargetInvokerCreationException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition; -import org.apache.tuscany.spi.model.physical.PhysicalWireSourceDefinition; -import org.apache.tuscany.spi.model.physical.PhysicalWireTargetDefinition; -import org.apache.tuscany.spi.services.work.WorkScheduler; -import org.apache.tuscany.spi.util.UriHelper; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.WirePostProcessorRegistry; - -import org.apache.tuscany.core.wire.InvocationChainImpl; -import org.apache.tuscany.core.wire.InvokerInterceptor; -import org.apache.tuscany.core.wire.NonBlockingInterceptor; -import org.apache.tuscany.core.wire.WireImpl; -import org.apache.tuscany.core.wire.WireUtils; - -/** - * The default connector implmentation - * - * @version $$Rev$$ $$Date$$ - */ -public class ConnectorImpl implements Connector { - private WirePostProcessorRegistry postProcessorRegistry; - private ComponentManager componentManager; - private WorkContext workContext; - private WorkScheduler scheduler; - private InterceptorBuilderRegistry interceptorBuilderRegistry; - private WireAttacherRegistry attacherRegistry; - - public ConnectorImpl(ComponentManager componentManager) { - this.componentManager = componentManager; - } - - @Constructor - public ConnectorImpl( - @org.osoa.sca.annotations.Reference InterceptorBuilderRegistry interceptorBuilderRegistry, - @org.osoa.sca.annotations.Reference WireAttacherRegistry attacherRegistry, - @org.osoa.sca.annotations.Reference WirePostProcessorRegistry processorRegistry, - @org.osoa.sca.annotations.Reference ComponentManager componentManager, - @org.osoa.sca.annotations.Reference WorkScheduler scheduler, - @org.osoa.sca.annotations.Reference WorkContext workContext) { - this.attacherRegistry = attacherRegistry; - this.interceptorBuilderRegistry = interceptorBuilderRegistry; - this.postProcessorRegistry = processorRegistry; - this.componentManager = componentManager; - this.scheduler = scheduler; - this.workContext = workContext; - } - - /** - * Note this method will not work yet - *

- * Wires a source and target component based on a wire defintion - * - * @param definition the wire definition - * @throws WiringException - */ - public void connect(PhysicalWireDefinition definition) throws BuilderException { - URI sourceUri = definition.getSourceUri(); - assert sourceUri != null; - URI targetUri = definition.getTargetUri(); - assert targetUri != null; - URI baseSourceUri = UriHelper.getDefragmentedName(sourceUri); - URI baseTargetUri = UriHelper.getDefragmentedName(targetUri); - Component source = componentManager.getComponent(baseSourceUri); - if (source == null) { - throw new ComponentNotFoundException("Wire source component not found", baseSourceUri); - } - Wire wire = createWire(definition); - - PhysicalWireSourceDefinition sourceDefinition = definition.getSource(); - PhysicalWireTargetDefinition targetDefinition = definition.getTarget(); - Component target; - if (baseTargetUri != null) { - target = componentManager.getComponent(baseTargetUri); - if (target == null) { - throw new ComponentNotFoundException("Wire target component not found", baseTargetUri); - } - } else { - target = null; - } - attacherRegistry.attachToSource(source, sourceDefinition, target, targetDefinition, wire); - attacherRegistry.attachToTarget(source, sourceDefinition, target, targetDefinition, wire); - } - - public void connect(ComponentDefinition> definition) throws WiringException { - URI sourceUri = definition.getUri(); - Component source = componentManager.getComponent(sourceUri); - if (source == null) { - throw new ComponentNotFoundException("Source not found", sourceUri); - } - ComponentType type = definition.getImplementation().getComponentType(); - if (type instanceof CompositeComponentType) { - CompositeComponentType compositeType = (CompositeComponentType) type; - for (ComponentDefinition> child : compositeType.getComponents().values()) { - connect(child); - } - for (ServiceDefinition child : compositeType.getServices().values()) { - connect(child); - } - for (ReferenceDefinition child : compositeType.getReferences().values()) { - connect(child); - } - } - Map targets = definition.getReferenceTargets(); - for (ReferenceTarget referenceTarget : targets.values()) { - List wires = new ArrayList(); - String refName = referenceTarget.getReferenceName().getFragment(); - ReferenceDefinition refDefinition = type.getReferences().get(refName); - assert refDefinition != null; - List uris = referenceTarget.getTargets(); - for (URI uri : uris) { - URI targetUri = UriHelper.getDefragmentedName(uri); - Component target = componentManager.getComponent(targetUri); - if (target == null && !refDefinition.isRequired()) { - // a non-required reference, just skip - continue; - } - if (target == null) { - throw new ComponentNotFoundException("Target not found", targetUri); - } - String fragment = uri.getFragment(); - URI sourceURI = refDefinition.getUri(); - Wire wire = createWire(sourceURI, uri, refDefinition.getServiceContract(), Wire.LOCAL_BINDING); - try { - attachInvokers(fragment, wire, source, target); - } catch (TargetInvokerCreationException e) { - throw new WireCreationException("Error creating invoker", sourceUri, targetUri, e); - } - if (postProcessorRegistry != null) { - postProcessorRegistry.process(wire); - } - optimize(source, target, wire); - wires.add(wire); - if (!wire.getCallbackInvocationChains().isEmpty()) { - target.attachCallbackWire(wire); - } - } - if (wires.size() > 1) { - // attach as a multiplicity - source.attachWires(wires); - } else if (wires.size() == 1) { - // attach as a single wire - Wire wire = wires.get(0); - source.attachWire(wire); - } - } - } - - /** - * @deprecated - */ - protected void connect(ServiceDefinition definition) throws WiringException { - URI uri = definition.getUri(); - URI sourceUri = UriHelper.getDefragmentedName(uri); - URI targetUri = definition.getTarget(); - URI baseTargetUri = UriHelper.getDefragmentedName(targetUri); - Component source = componentManager.getComponent(sourceUri); - if (source == null) { - throw new ComponentNotFoundException("Source not found", sourceUri); - } - Service service = source.getService(uri.getFragment()); - if (service == null) { - throw new SourceServiceNotFoundException("Service not found on composite", uri); - } - Component target = componentManager.getComponent(baseTargetUri); - if (target == null) { - throw new ComponentNotFoundException("Target not found", sourceUri); - } - ServiceContract contract = definition.getServiceContract(); - // TODO if no binding, do local - for (ServiceBinding binding : service.getServiceBindings()) { - Wire wire = createWire(uri, targetUri, contract, binding.getBindingType()); - binding.setWire(wire); - if (postProcessorRegistry != null) { - postProcessorRegistry.process(wire); - } - try { - attachInvokers(definition.getTarget().getFragment(), wire, binding, target); - } catch (TargetInvokerCreationException e) { - throw new WireCreationException("Error creating invoker", sourceUri, baseTargetUri, e); - } - } - } - - /** - * @deprecated - */ - protected void connect(ReferenceDefinition definition) throws WiringException { - URI uri = definition.getUri(); - URI sourceUri = UriHelper.getDefragmentedName(uri); - Component source = componentManager.getComponent(sourceUri); - if (source == null) { - throw new ComponentNotFoundException("Source not found", sourceUri); - } - Reference reference = source.getReference(uri.getFragment()); - if (reference == null) { - throw new SourceServiceNotFoundException("Reference not found on composite", uri); - } - - for (ReferenceBinding binding : reference.getReferenceBindings()) { - // create wire - if (Wire.LOCAL_BINDING.equals(binding.getBindingType())) { - URI targetUri = binding.getTargetUri(); - ServiceContract contract = binding.getBindingServiceContract(); - QName type = binding.getBindingType(); - Wire wire = createWire(sourceUri, targetUri, contract, type); - binding.setWire(wire); - // wire local bindings to their targets - Component target = componentManager.getComponent(UriHelper.getDefragmentedName(targetUri)); - if (target == null) { - throw new ComponentNotFoundException("Target not found", sourceUri); - } - try { - attachInvokers(targetUri.getFragment(), wire, binding, target); - } catch (TargetInvokerCreationException e) { - throw new WireCreationException("Error creating invoker", sourceUri, targetUri, e); - } - } else { - Wire wire = createWire(sourceUri, null, binding.getBindingServiceContract(), binding.getBindingType()); - if (postProcessorRegistry != null) { - postProcessorRegistry.process(wire); - } - binding.setWire(wire); - } - } - } - - protected Wire createWire(PhysicalWireDefinition definition) throws BuilderException { - URI sourceURI = definition.getSourceUri(); - URI targetUri = definition.getTargetUri(); - Wire wire = new WireImpl(); - wire.setSourceUri(sourceURI); - wire.setTargetUri(targetUri); - for (PhysicalOperationDefinition operation : definition.getOperations()) { - InvocationChain chain = new InvocationChainImpl(operation); - for (PhysicalInterceptorDefinition interceptorDefinition : operation.getInterceptors()) { - Interceptor interceptor = interceptorBuilderRegistry.build(interceptorDefinition); - chain.addInterceptor(interceptor); - } - wire.addInvocationChain(operation, chain); - } - return wire; - } - - protected Wire createWire(URI sourceURI, URI targetUri, ServiceContract contract, QName bindingType) { - Wire wire = new WireImpl(bindingType); - wire.setSourceContract(contract); - wire.setTargetContract(contract); - wire.setSourceUri(sourceURI); - wire.setTargetUri(targetUri); - for (Operation operation : contract.getOperations().values()) { - InvocationChain chain = new InvocationChainImpl(operation); - if (operation.isNonBlocking()) { - chain.addInterceptor(new NonBlockingInterceptor(scheduler, workContext)); - } - chain.addInterceptor(new InvokerInterceptor()); - wire.addInvocationChain(operation, chain); - - } - for (Operation operation : contract.getCallbackOperations().values()) { - InvocationChain chain = new InvocationChainImpl(operation); - if (operation.isNonBlocking()) { - chain.addInterceptor(new NonBlockingInterceptor(scheduler, workContext)); - } - chain.addInterceptor(new InvokerInterceptor()); - wire.addCallbackInvocationChain(operation, chain); - } - return wire; - } - - /** - * @Deprecated - */ - private void attachInvokers(String name, Wire wire, Invocable source, Invocable target) - throws TargetInvokerCreationException { - // TODO section will deleted be replaced when we cut-over to the physical marshallers - for (InvocationChain chain : wire.getInvocationChains().values()) { - chain.setTargetInvoker(target.createTargetInvoker(name, chain.getOperation())); - } - for (InvocationChain chain : wire.getCallbackInvocationChains().values()) { - chain.setTargetInvoker(source.createTargetInvoker(null, chain.getOperation())); - } - } - - /** - * @Deprecated - */ - protected void optimize(Component source, Component target, Wire wire) { - boolean optimizableScopes = isOptimizable(source.getScope(), target.getScope()); - if (optimizableScopes && target.isOptimizable() && WireUtils.isOptimizable(wire)) { - wire.setOptimizable(true); - wire.setTarget((AtomicComponent) target); - } else { - wire.setOptimizable(false); - } - } - - protected boolean isOptimizable(Scope pReferrer, Scope pReferee) { - if (pReferrer == Scope.UNDEFINED - || pReferee == Scope.UNDEFINED - || pReferrer == Scope.CONVERSATION - || pReferee == Scope.CONVERSATION) { - return false; - } - if (pReferee == pReferrer) { - return true; - } else if (pReferrer == Scope.STATELESS) { - return true; - } else if (pReferee == Scope.STATELESS) { - return false; - } else if (pReferrer == Scope.REQUEST && pReferee == Scope.SESSION) { - return true; - } else if (pReferrer == Scope.REQUEST && pReferee == Scope.COMPOSITE) { - return true; - } else if (pReferrer == Scope.REQUEST && pReferee == Scope.SYSTEM) { - return true; - } else if (pReferrer == Scope.SESSION && pReferee == Scope.COMPOSITE) { - return true; - } else if (pReferrer == Scope.SESSION && pReferee == Scope.SYSTEM) { - return true; - } else //noinspection SimplifiableIfStatement - if (pReferrer == Scope.SYSTEM && pReferee == Scope.COMPOSITE) { - // case where a service context points to a composite scoped component - return true; - } else { - return pReferrer == Scope.COMPOSITE && pReferee == Scope.SYSTEM; - } - } -} \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java deleted file mode 100644 index 183ccea1b8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes an illegal callback - * - * @version $Rev$ $Date$ - */ -public class IllegalCallbackException extends WiringException { - - public IllegalCallbackException(String message, String identifier, URI sourceUri, URI targetUri) { - super(message, identifier, sourceUri, targetUri); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java deleted file mode 100644 index 1a9c74aa3b..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes an attempt to wire incompatible interfaces - * - * @version $Rev$ $Date$ - */ -public class IncompatibleInterfacesException extends WiringException { - - public IncompatibleInterfacesException(URI source, URI target) { - super("Incompatible source and target interfaces", source, target); - } - - public IncompatibleInterfacesException(URI source, URI target, Throwable throwable) { - super("Incompatible source and target interfaces", source, target, throwable); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java deleted file mode 100644 index d9df445530..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes an invalid source type for a wire - * - * @version $Rev$ $Date$ - */ -public class InvalidSourceTypeException extends WiringException { - - public InvalidSourceTypeException(String message, URI sourceUri, URI targetUri) { - super(message, sourceUri, targetUri); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java deleted file mode 100644 index e3c26c75d2..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes an invalid target service for a wire - * - * @version $Rev$ $Date$ - */ -public class InvalidTargetTypeException extends WiringException { - - public InvalidTargetTypeException(String message, URI sourceUri, URI targetUri) { - super(message, sourceUri, targetUri); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java deleted file mode 100644 index c351013297..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes no binding was specified for a wire - * - * @version $Rev$ $Date$ - */ -public class NoBindingException extends WiringException { - - public NoBindingException(String message, URI sourceUri, URI targetUri) { - super(message, sourceUri, targetUri); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java deleted file mode 100644 index 3c49767333..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * @version $Rev$ $Date$ - */ -public class NoCompatibleBindingsException extends WiringException { - - public NoCompatibleBindingsException(URI sourceName, URI targetName) { - super("No compatible bindings for source and target", sourceName, targetName); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java deleted file mode 100644 index 71eb9ebd26..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.spi.builder.BuilderException; - -/** - * Raised when a component has conversational scope but no conversational contract - * - * @version $Rev: 487877 $ $Date: 2006-12-16 15:32:16 -0500 (Sat, 16 Dec 2006) $ - */ -public class NoConversationalContractException extends BuilderException { - - public NoConversationalContractException(String message, String identifier) { - super(message, identifier); - } - - public NoConversationalContractException(String message) { - super(message); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java deleted file mode 100644 index 340a20f239..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.spi.builder.BuilderException; - -/** - * Raised when a builder cannot be found for a SCDL entry type - * - * @version $Rev$ $Date$ - */ -public class NoRegisteredBuilderException extends BuilderException { - - public NoRegisteredBuilderException(String message, String identifier) { - super(message, identifier); - } - - public NoRegisteredBuilderException(String message) { - super(message); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java deleted file mode 100644 index 7d3d49b937..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Indicates the source service of a wire was not found - * - * @version $Rev$ $Date$ - */ -public class SourceServiceNotFoundException extends WiringException { - - public SourceServiceNotFoundException(String message, URI sourceName) { - super(message, sourceName, null); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java deleted file mode 100644 index f22b421aa7..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Indicates the target service of a reference was not found - * - * @version $Rev$ $Date$ - */ -public class TargetServiceNotFoundException extends WiringException { - - public TargetServiceNotFoundException(String message, URI sourceName, URI targetName) { - super(message, sourceName, targetName); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WireCreationException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WireCreationException.java deleted file mode 100644 index 117bb23180..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WireCreationException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -/** - * Denotes an error creating a wire - * - * @version $Rev$ $Date$ - */ -public class WireCreationException extends WiringException { - - public WireCreationException(String message, URI sourceUri, Throwable e) { - super(message, sourceUri, null, e); - } - - public WireCreationException(String message, URI sourceUri, URI targetUri, Throwable e) { - super(message, sourceUri, targetUri, e); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java deleted file mode 100644 index 6f611956be..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.WirePostProcessor; -import org.apache.tuscany.spi.wire.WirePostProcessorRegistry; - -/** - * The default implementation of a WirePostProcessor - * - * @version $Rev$ $Date$ - */ -public class WirePostProcessorRegistryImpl implements WirePostProcessorRegistry { - - private final List processors = new ArrayList(); - - public void process(Wire wire) { - for (WirePostProcessor processor : processors) { - processor.process(wire); - } - } - - public void register(WirePostProcessor processor) { - processors.add(processor); - } - - public void unregister(WirePostProcessor processor) { - processors.remove(processor); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java deleted file mode 100644 index 661dc8bfea..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.io.PrintWriter; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.builder.WiringException; - -import org.apache.tuscany.host.monitor.ExceptionFormatter; -import org.apache.tuscany.host.monitor.FormatterRegistry; - -/** - * Formats {@link WiringException}s - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class WiringExceptionFormatter implements ExceptionFormatter { - private FormatterRegistry factory; - - public WiringExceptionFormatter(@Reference FormatterRegistry factory) { - this.factory = factory; - factory.register(this); - } - - public boolean canFormat(Class type) { - return WiringException.class.isAssignableFrom(type); - } - - @Destroy - public void destroy() { - factory.unregister(this); - } - - public PrintWriter write(PrintWriter writer, Throwable exception) { - assert exception instanceof WiringException; - WiringException e = (WiringException) exception; - e.appendBaseMessage(writer); - if (e.getSourceUri() != null) { - writer.write("\nSource : " + e.getSourceUri()); - } - if (e.getTargetUri() != null) { - writer.write("\nTarget : " + e.getTargetUri()); - } - return writer; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallableReferenceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallableReferenceImpl.java deleted file mode 100644 index e674112a89..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallableReferenceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import org.osoa.sca.CallableReference; -import org.osoa.sca.Conversation; - -import org.apache.tuscany.spi.ObjectFactory; - -/** - * Base class for implementations of service and callback references. - * - * @version $Rev$ $Date$ - * @param the type of the business interface - */ -public abstract class CallableReferenceImpl implements CallableReference { - private final Class businessInterface; - private final ObjectFactory factory; - - protected CallableReferenceImpl(Class businessInterface, ObjectFactory factory) { - this.businessInterface = businessInterface; - this.factory = factory; - } - - public B getService() { - return factory.getInstance(); - } - - public Class getBusinessInterface() { - return businessInterface; - } - - public boolean isConversational() { - return false; - } - - public Conversation getConversation() { - return null; - } - - public Object getCallbackID() { - return null; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallbackReferenceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallbackReferenceImpl.java deleted file mode 100644 index 532a8b2bad..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/CallbackReferenceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import org.apache.tuscany.spi.ObjectFactory; - -/** - * Default implementation of a callback reference. - * - * @version $Rev$ $Date$ - * @param the type of the business interface - */ -public class CallbackReferenceImpl extends CallableReferenceImpl { - public CallbackReferenceImpl(Class businessInterface, ObjectFactory factory) { - super(businessInterface, factory); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java deleted file mode 100644 index c8047abdab..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import org.osoa.sca.CallableReference; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.RequestContext; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.ServiceRuntimeException; - -import org.apache.tuscany.api.TuscanyRuntimeException; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; - -/** - * Implementation of ComponentContext that delegates to a ComponentContextProvider. - * - * @version $Rev$ $Date$ - */ -public class ComponentContextImpl implements ComponentContext { - private final ComponentContextProvider component; - - public ComponentContextImpl(ComponentContextProvider component) { - this.component = component; - } - - public String getURI() { - try { - return component.getUri().toString(); - } catch (TuscanyRuntimeException e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } - } - - public > R cast(B target) throws IllegalArgumentException { - try { - return (R) component.cast(target); - } catch (TuscanyRuntimeException e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } - } - - public B getService(Class businessInterface, String referenceName) { - try { - return component.getService(businessInterface, referenceName); - } catch (TuscanyRuntimeException e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } - } - - public ServiceReference getServiceReference(Class businessInterface, String referenceName) { - try { - return component.getServiceReference(businessInterface, referenceName); - } catch (TuscanyRuntimeException e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } - } - - public B getProperty(Class type, String propertyName) { - try { - return component.getProperty(type, propertyName); - } catch (TuscanyRuntimeException e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } - } - - public ServiceReference createSelfReference(Class businessInterface) { - // FIXME: How to get the ObjectFactory? - ObjectFactory factory = ((AtomicComponent) component).createObjectFactory(); - return new ServiceReferenceImpl(businessInterface, factory); - } - - public ServiceReference createSelfReference(Class businessInterface, String serviceName) { - return null; - } - - public RequestContext getRequestContext() { - return null; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextProvider.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextProvider.java deleted file mode 100644 index 4237d8b09f..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentContextProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; - -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.CallableReference; - -/** - * Interface implemented by Component's that want to expose a ComponentContext. - * - * @version $Rev$ $Date$ - */ -public interface ComponentContextProvider { - ComponentContext getComponentContext(); - - URI getUri(); - - B getService(Class businessInterface, String referenceName); - - ServiceReference getServiceReference(Class businessInterface, String referenceName); - - B getProperty(Class type, String propertyName); - - > R cast(B target); -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentManagerImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentManagerImpl.java deleted file mode 100644 index 76958c88ff..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ComponentManagerImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.DuplicateNameException; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.services.management.TuscanyManagementService; -import org.apache.tuscany.spi.idl.java.JavaServiceContract; - -import org.apache.tuscany.core.resolver.AutowireResolver; - -/** - * Default implementation of the component manager - * - * @version $Rev$ $Date$ - */ -public class ComponentManagerImpl implements ComponentManager { - private TuscanyManagementService managementService; - private AutowireResolver resolver; - private Map components; - - public ComponentManagerImpl() { - components = new ConcurrentHashMap(); - } - - public ComponentManagerImpl(TuscanyManagementService managementService, AutowireResolver resolver) { - this(); - this.managementService = managementService; - this.resolver = resolver; - } - - public synchronized void register(Component component) throws RegistrationException { - URI uri = component.getUri(); - assert uri != null; - assert !uri.toString().endsWith("/"); - if (components.containsKey(uri)) { - throw new DuplicateNameException(uri.toString()); - } - components.put(uri, component); - - if (managementService != null && component instanceof AtomicComponent) { - // FIXME shouldn't it take the canonical name and also not distinguish atomic components? - managementService.registerComponent(component.getUri().toString(), component); - } - } - - public void registerJavaObject(URI uri, JavaServiceContract service, I instance) - throws RegistrationException { - SystemSingletonAtomicComponent component = - new SystemSingletonAtomicComponent(uri, service, instance); - register(component); - if (resolver != null) { - for (ServiceContract contract : component.getServiceContracts()) { - resolver.addHostUri(contract, uri); - } - } - } - - public void registerJavaObject(URI uri, List> services, I instance) - throws RegistrationException { - SystemSingletonAtomicComponent component = - new SystemSingletonAtomicComponent(uri, services, instance); - register(component); - if (resolver != null) { - for (ServiceContract contract : component.getServiceContracts()) { - resolver.addHostUri(contract, uri); - } - } - } - - public synchronized void unregister(Component component) throws RegistrationException { - URI uri = component.getUri(); - components.remove(uri); - } - - public Component getComponent(URI name) { - return components.get(name); - } - - public void onEvent(Event event) { - throw new UnsupportedOperationException(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java deleted file mode 100644 index 35125b85ef..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -/** - * 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.spi.component.WorkContext - */ -public interface ScopeIdentifier { - - /** - * Returns the scope id for the request. - */ - Object getIdentifier(); -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java deleted file mode 100644 index 4d57d3efe0..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import org.osoa.sca.ServiceReference; - -import org.apache.tuscany.spi.ObjectFactory; - -/** - * Default implementation of a ServiceReference. - * - * @version $Rev$ $Date$ - * @param the type of the business interface - */ -public class ServiceReferenceImpl extends CallableReferenceImpl implements ServiceReference { - public ServiceReferenceImpl(Class businessInterface, ObjectFactory factory) { - super(businessInterface, factory); - } - - public Object getConversationID() { - return null; - } - - public void setConversationID(Object conversationId) throws IllegalStateException { - } - - public void setCallbackID(Object callbackID) { - } - - public Object getCallback() { - return null; - } - - public void setCallback(Object callback) { - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SimpleWorkContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SimpleWorkContext.java deleted file mode 100644 index 7e978f6f35..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SimpleWorkContext.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.util.Map; -import java.util.HashMap; -import java.util.List; -import java.util.LinkedList; -import java.util.ArrayList; -import java.net.URI; - -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.wire.Wire; - -/** - * A simple WorkContext implementation that provides basic thread-local support - * for storing work context information. The implementation is not - * thread safe. - * - * @version $Rev$ $Date$ - */ -public class SimpleWorkContext implements WorkContext { - private final Map identifiers = new HashMap(); - private final List serviceNameStack = new ArrayList(); - - private LinkedList callbackUris; - private LinkedList callbackWires; - private Object correlationId; - private AtomicComponent currentAtomicComponent; - - public Object getIdentifier(Object type) { - return identifiers.get(type); - } - - public void setIdentifier(Object type, Object identifier) { - identifiers.put(type, identifier); - } - - public void clearIdentifier(Object type) { - identifiers.remove(type); - } - - public void clearIdentifiers() { - identifiers.clear(); - } - - public LinkedList getCallbackUris() { - return callbackUris; - } - - public void setCallbackUris(LinkedList uris) { - this.callbackUris = uris; - } - - public LinkedList getCallbackWires() { - return callbackWires; - } - - public void setCallbackWires(LinkedList wires) { - this.callbackWires = wires; - } - - public Object getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(Object correlationId) { - this.correlationId = correlationId; - } - - public AtomicComponent getCurrentAtomicComponent() { - return currentAtomicComponent; - } - - public void setCurrentAtomicComponent(AtomicComponent currentAtomicComponent) { - this.currentAtomicComponent = currentAtomicComponent; - } - - public String getCurrentServiceName() { - assert !serviceNameStack.isEmpty(); - return serviceNameStack.get(serviceNameStack.size() - 1); - } - - public void pushServiceName(String name) { - serviceNameStack.add(name); - } - - public String popServiceName() { - assert !serviceNameStack.isEmpty(); - return serviceNameStack.remove(serviceNameStack.size() - 1); - } - - public void clearServiceNames() { - serviceNameStack.clear(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponent.java deleted file mode 100644 index 872853506e..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponent.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.spi.ObjectCreationException; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.TargetInvokerCreationException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.extension.AbstractComponentExtension; -import org.apache.tuscany.spi.idl.java.JavaServiceContract; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * An {@link org.apache.tuscany.spi.component.AtomicComponent} used when registering objects directly into a composite - * - * @version $$Rev$$ $$Date$$ - */ -public class SystemSingletonAtomicComponent extends AbstractComponentExtension - implements AtomicComponent { - private T instance; - private List serviceContracts = new ArrayList(); - - public SystemSingletonAtomicComponent(URI name, JavaServiceContract contract, T instance) { - super(name); - this.instance = instance; - this.serviceContracts.add(contract); - } - - public SystemSingletonAtomicComponent(URI name, List> services, T instance) { - super(name); - this.instance = instance; - for (ServiceContract contract : services) { - serviceContracts.add(contract); - } - } - - public Scope getScope() { - return Scope.COMPOSITE; - } - - public boolean isEagerInit() { - return false; - } - - public int getInitLevel() { - return 0; - } - - public long getMaxIdleTime() { - return -1; - } - - public long getMaxAge() { - return -1; - } - - public T getTargetInstance() throws TargetResolutionException { - return instance; - } - - public Object createInstance() throws ObjectCreationException { - throw new UnsupportedOperationException(); - } - - public void removeInstance() { - throw new UnsupportedOperationException(); - } - - public InstanceWrapper createInstanceWrapper() throws ObjectCreationException { - throw new UnsupportedOperationException(); - } - - public ObjectFactory createObjectFactory() { - return new SingletonObjectFactory(instance); - } - - public boolean isOptimizable() { - return true; - } - - public void attachWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public void attachWires(List wires) { - throw new UnsupportedOperationException(); - } - - public List getWires(String name) { - throw new UnsupportedOperationException(); - } - - public void attachCallbackWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public TargetInvoker createTargetInvoker(String targetName, Operation operation) { - return null; - } - - public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) - throws TargetInvokerCreationException { - return null; - } - - public List getServiceContracts() { - return serviceContracts; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java deleted file mode 100644 index 3eb6e9d3eb..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; -import java.util.ArrayList; -import java.util.IdentityHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.wire.Wire; - -/** - * An implementation of an {@link org.apache.tuscany.spi.component.WorkContext} that handles event-to-thread - * associations using an InheritableThreadLocal - * - * @version $Rev$ $Date$ - */ -public class WorkContextImpl implements WorkContext { - private static final Object CORRELATION_ID = new Object(); - private static final Object CALLBACK_URIS = new Object(); - private static final Object CURRENT_ATOMIC = new Object(); - private static final Object CURRENT_SERVICE_NAMES = new Object(); - private static final Object CALLBACK_WIRES = new Object(); - - // [rfeng] We cannot use InheritableThreadLocal for message ids here since it's shared by parent and children - private ThreadLocal> workContext = new ThreadLocal>(); - - // [rfeng] Session id requires InheritableThreadLocal - private ThreadLocal> inheritableContext = new InheritableThreadLocal>(); - - public WorkContextImpl() { - super(); - } - - public Object getCorrelationId() { - Map map = workContext.get(); - if (map == null) { - return null; - } - return map.get(CORRELATION_ID); - } - - public void setCorrelationId(Object id) { - Map map = getWorkContextMap(); - map.put(CORRELATION_ID, id); - } - - public AtomicComponent getCurrentAtomicComponent() { - Map map = workContext.get(); - if (map == null) { - return null; - } - return (AtomicComponent) map.get(CURRENT_ATOMIC); - } - - public void setCurrentAtomicComponent(AtomicComponent component) { - Map map = getWorkContextMap(); - map.put(CURRENT_ATOMIC, component); - } - - @SuppressWarnings("unchecked") - public LinkedList getCallbackUris() { - Map map = workContext.get(); - if (map == null) { - return null; - } - return (LinkedList) map.get(CALLBACK_URIS); - } - - public void setCallbackUris(LinkedList uris) { - Map map = getWorkContextMap(); - map.put(CALLBACK_URIS, uris); - } - - - @SuppressWarnings({"unchecked"}) - public LinkedList getCallbackWires() { - Map map = workContext.get(); - if (map == null) { - return null; - } - return (LinkedList) map.get(CALLBACK_WIRES); - } - - public void setCallbackWires(LinkedList wires) { - Map map = getWorkContextMap(); - map.put(CALLBACK_WIRES, wires); - } - - - public Object getIdentifier(Object type) { - Map map = inheritableContext.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 = inheritableContext.get(); - if (map == null) { - map = new IdentityHashMap(); - inheritableContext.set(map); - } - map.put(type, identifier); - } - - public void clearIdentifier(Object type) { - if (type == null) { - return; - } - Map map = inheritableContext.get(); - if (map != null) { - map.remove(type); - } - } - - public void clearIdentifiers() { - inheritableContext.remove(); - } - - @SuppressWarnings({"unchecked"}) - public String popServiceName() { - Map map = inheritableContext.get(); - if (map == null) { - return null; - } - List stack = (List) map.get(CURRENT_SERVICE_NAMES); - if (stack == null || stack.size() < 1) { - return null; - } - String name = stack.remove(stack.size() - 1); - if (stack.size() == 0) { - // cleanup to avoid leaks - map.remove(CURRENT_SERVICE_NAMES); - } - return name; - } - - @SuppressWarnings({"unchecked"}) - public String getCurrentServiceName() { - Map map = inheritableContext.get(); - if (map == null) { - return null; - } - List stack = (List) map.get(CURRENT_SERVICE_NAMES); - if (stack == null || stack.size() < 1) { - return null; - } - return stack.get(stack.size() - 1); - } - - @SuppressWarnings({"unchecked"}) - public void pushServiceName(String name) { - Map map = inheritableContext.get(); - List names; - if (map == null) { - map = new IdentityHashMap(); - inheritableContext.set(map); - names = new ArrayList(); - map.put(CURRENT_SERVICE_NAMES, names); - } else { - names = (List) map.get(CURRENT_SERVICE_NAMES); - if (names == null) { - names = new ArrayList(); - map.put(CURRENT_SERVICE_NAMES, names); - } - } - names.add(name); - } - - public void clearServiceNames() { - Map map = inheritableContext.get(); - if (map == null) { - return; - } - map.remove(CURRENT_SERVICE_NAMES); - } - - private Map getWorkContextMap() { - Map map = workContext.get(); - if (map == null) { - map = new IdentityHashMap(); - workContext.set(map); - } - return map; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java deleted file mode 100644 index 6d026ca08c..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -import org.apache.tuscany.spi.event.Event; - -/** - * A basic implementation of a runtime event - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class AbstractEvent implements Event { - protected Object source; - - public AbstractEvent(Object source) { - assert source != null : "Source id was null"; - this.source = source; - } - - public Object getSource() { - return source; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java deleted file mode 100644 index 762b917600..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Base implementation of a request event - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class AbstractRequestEvent extends AbstractEvent implements RequestEvent { - - /** - * Creates a new event - * - * @param source the source of the event - */ - public AbstractRequestEvent(Object source) { - super(source); - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentEvent.java deleted file mode 100644 index 7de32a56d0..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -import java.net.URI; - -import org.apache.tuscany.spi.event.Event; - -/** - * Implemented by runtime events associated with a component, e.g. lifecycle events - * - * @version $$Rev$$ $$Date$$ - */ -public interface ComponentEvent extends Event { - - URI getComponentUri(); - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStart.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStart.java deleted file mode 100644 index 6be1c88d3f..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStart.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -import java.net.URI; - -/** - * Propagated when a component starts - * - * @version $$Rev$$ $$Date$$ - */ -public class ComponentStart extends AbstractEvent implements ComponentEvent { - - private URI uri; - - /** - * Creates a component start event - * - * @param source the source of the event - * @param componentURI the uri of the component being started - */ - public ComponentStart(Object source, URI componentURI) { - super(source); - this.uri = componentURI; - } - - public URI getComponentUri() { - return uri; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStop.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStop.java deleted file mode 100644 index ac0a7fd5c0..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ComponentStop.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -import java.net.URI; - -/** - * Propagated when a component stops - * - * @version $$Rev$$ $$Date$$ - */ -public class ComponentStop extends AbstractEvent implements ComponentEvent { - - private URI uri; - - /** - * Creates a component stop event - * - * @param source the source of the event - * @param componentUri the composite component associated the component being stopped - */ - public ComponentStop(Object source, URI componentUri) { - super(source); - this.uri = componentUri; - } - - public URI getComponentUri() { - return uri; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java deleted file mode 100644 index 4a51d970c3..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when a conversation session is expired - * - * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ - */ -public class ConversationEnd extends ConversationalEvent { - - public ConversationEnd(Object source, Object id) { - super(source, id); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java deleted file mode 100644 index 5725369bf6..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when a conversation session has started - * - * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ - */ -public class ConversationStart extends ConversationalEvent { - - public ConversationStart(Object source, Object id) { - super(source, id); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java deleted file mode 100644 index a75086e745..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * A base implementation of conversational session events in the runtime - * - * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ - */ -public class ConversationalEvent extends AbstractEvent { - - private Object id; - - public ConversationalEvent(Object source, Object id) { - super(source); - assert id != null : "Conversation id was null"; - this.id = id; - } - - public Object getId() { - return id; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java deleted file mode 100644 index 01bd769031..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when an HTTP-based request has ended. - * - * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ - */ -public class HttpRequestEnded extends HttpSessionEvent { - - /** - * Creates a new event - * - * @param source the source of the event - * @param id the id of the HTTP session being ended - */ - public HttpRequestEnded(Object source, Object id) { - super(source, id); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java deleted file mode 100644 index 9d0ff80dd7..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when an HTTP-based request has started - * - * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ - */ -public class HttpRequestStart extends HttpSessionEvent { - - /** - * Creates a new event - * - * @param source the source of the event - * @param id the id of the HTTP session being ended - */ - public HttpRequestStart(Object source, Object id) { - super(source, id); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java deleted file mode 100644 index 7f2bebe94a..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when an HTTP-based session is expired - * - * @version $$Rev$$ $$Date$$ - */ -public class HttpSessionEnd extends HttpSessionEvent { - - /** - * 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/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java deleted file mode 100644 index ed245d0930..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * A base implementation of HTTP-based session events in the runtime - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class HttpSessionEvent extends AbstractEvent { - - private Object id; - - public HttpSessionEvent(Object source, Object id) { - super(source); - assert id != null : "Session id was null"; - this.id = id; - } - - - public Object getSource() { - return source; - } - - public Object getId() { - return id; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java deleted file mode 100644 index 7f9c0fadea..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Propagated when an HTTP-based session has started - * - * @version $$Rev$$ $$Date$$ - */ -public class HttpSessionStart extends HttpSessionEvent { - - /** - * Creates a new event - * - * @param source the source of the event - * @param id the id of the HTTP session being ended - */ - public HttpSessionStart(Object source, Object id) { - super(source, id); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java deleted file mode 100644 index 25856e86f8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.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 - */ - public RequestEnd(Object source) { - super(source); - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java deleted file mode 100644 index 9a6d767236..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -/** - * Implemented by runtime events associated request - * - * @version $$Rev$$ $$Date$$ - */ -public interface RequestEvent { - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java deleted file mode 100644 index 466f52551a..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.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 - */ - public RequestStart(Object source) { - super(source); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java deleted file mode 100644 index 7fa8765426..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.AbstractLifecycle; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.GroupInitializationException; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.PersistenceException; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.model.Scope; - -/** - * Implements functionality common to scope contexts. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractScopeContainer extends AbstractLifecycle - implements ScopeContainer { - - private static final Comparator> COMPARATOR = new Comparator>() { - public int compare(AtomicComponent o1, AtomicComponent o2) { - return o1.getInitLevel() - o2.getInitLevel(); - } - }; - - private final Scope scope; - protected final ScopeContainerMonitor monitor; - - protected final Map, URI> componentGroups = - new ConcurrentHashMap, URI>(); - - protected final Map contextGroups = new ConcurrentHashMap(); - - // the queue of components to eagerly initialize in each group - protected final Map>> initQueues = - new HashMap>>(); - - // the queue of instanceWrappers to destroy, in the order that their instances were created - protected final Map>> destroyQueues = - new ConcurrentHashMap>>(); - - public AbstractScopeContainer(Scope scope, ScopeContainerMonitor monitor) { - this.scope = scope; - this.monitor = monitor; - } - - public Scope getScope() { - return scope; - } - - @Reference - public void setScopeRegistry(ScopeRegistry scopeRegistry) { - scopeRegistry.register(this); - } - - @Init - public synchronized void start() { - int lifecycleState = getLifecycleState(); - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); - } - setLifecycleState(RUNNING); - } - - @Destroy - public synchronized void stop() { - int lifecycleState = getLifecycleState(); - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); - } - setLifecycleState(STOPPED); - componentGroups.clear(); - contextGroups.clear(); - synchronized (initQueues) { - initQueues.clear(); - } - destroyQueues.clear(); - } - - protected void checkInit() { - if (getLifecycleState() != RUNNING) { - throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]"); - } - } - - public void onEvent(Event event) { - } - - public void register(AtomicComponent component, URI groupId) { - checkInit(); - if (component.isEagerInit()) { - componentGroups.put(component, groupId); - synchronized (initQueues) { - List> initQueue = initQueues.get(groupId); - if (initQueue == null) { - initQueue = new ArrayList>(); - initQueues.put(groupId, initQueue); - } - // FIXME it would be more efficient to binary search and then insert - initQueue.add(component); - Collections.sort(initQueue, COMPARATOR); - } - } - } - - public void unregister(AtomicComponent component) { - if (component.isEagerInit()) { - URI groupId = componentGroups.remove(component); - synchronized (initQueues) { - List> initQueue = initQueues.get(groupId); - initQueue.remove(component); - if (initQueue.isEmpty()) { - initQueues.remove(groupId); - } - } - } - } - - public void startContext(KEY contextId, URI groupId) throws GroupInitializationException { - assert !contextGroups.containsKey(contextId); - contextGroups.put(contextId, groupId); - destroyQueues.put(contextId, new ArrayList>()); - - // get and clone initialization queue - List> initQueue; - synchronized (initQueues) { - initQueue = initQueues.get(groupId); - if (initQueue != null) { - initQueue = new ArrayList>(initQueue); - } - } - if (initQueue != null) { - initializeComponents(contextId, initQueue); - } - } - - public void stopContext(KEY contextId) { - assert contextGroups.containsKey(contextId); - shutdownComponents(destroyQueues.get(contextId)); - contextGroups.remove(contextId); - destroyQueues.remove(contextId); - } - - public InstanceWrapper getWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - return null; - } - - public InstanceWrapper getAssociatedWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - return null; - } - - public void returnWrapper(AtomicComponent component, InstanceWrapper wrapper, KEY contextId) - throws TargetDestructionException { - } - - public void remove(AtomicComponent component) throws PersistenceException { - throw new UnsupportedOperationException("Scope does not support persistence"); - } - - /** - * Initialise an ordered list of components. - * The list is traversed in order and the getWrapper() method called for each to - * associate an instance with the supplied context. - * - * @param contextId the contextId to associated with the component instances - * @param components the components to be initialized - * @throws GroupInitializationException if one or more components threw an exception during initialization - */ - protected void initializeComponents(KEY contextId, List> components) - throws GroupInitializationException { - List causes = null; - for (AtomicComponent component : components) { - try { - getWrapper(component, contextId); - - } catch (Exception e) { - if (causes == null) { - causes = new ArrayList(); - } - causes.add(e); - } - } - if (causes != null) { - throw new GroupInitializationException(String.valueOf(contextId), causes); - } - } - - /** - * Shut down an ordered list of instances. - * The list passed to this method is treated as a live, mutable list - * so any instances added to this list as shutdown is occuring will also be shut down. - * - * @param instances the list of instances to shutdown - */ - protected void shutdownComponents(List> instances) { - while (true) { - InstanceWrapper toDestroy; - synchronized (instances) { - if (instances.size() == 0) { - return; - } - toDestroy = instances.remove(instances.size() - 1); - } - try { - toDestroy.stop(); - } catch (TargetDestructionException e) { - // log the error from destroy but continue - monitor.destructionError(e); - } - } - } - - public String toString() { - return "In state [" + super.toString() + ']'; - } - - /** - * Creates a new physical instance of a component, wrapped in an InstanceWrapper. - * - * @param component the component whose instance should be created - * @return a wrapped instance that has been injected but not yet started - * @throws TargetResolutionException if there was a problem creating the instance - */ - protected InstanceWrapper createInstance(AtomicComponent component) throws TargetResolutionException { - return component.createInstanceWrapper(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java deleted file mode 100644 index 1a5dbcdcd4..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Service; - -import org.apache.tuscany.api.annotation.Monitor; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetInitializationException; -import org.apache.tuscany.spi.component.TargetNotFoundException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.model.Scope; - -/** - * A scope context which manages atomic component instances keyed by composite - * - * @version $Rev$ $Date$ - */ -@EagerInit -@Service(ScopeContainer.class) -public class CompositeScopeContainer extends AbstractScopeContainer { - private static final InstanceWrapper EMPTY = new InstanceWrapper() { - public Object getInstance() { - return null; - } - - public boolean isStarted() { - return true; - } - - public void start() throws TargetInitializationException { - - } - - public void stop() throws TargetDestructionException { - - } - }; - - // there is one instance per component so we can index directly - private final Map, InstanceWrapper> instanceWrappers = - new ConcurrentHashMap, InstanceWrapper>(); - - public CompositeScopeContainer(@Monitor ScopeContainerMonitor monitor) { - super(Scope.COMPOSITE, monitor); - } - - public void register(AtomicComponent component, URI groupId) { - super.register(component, groupId); - instanceWrappers.put(component, EMPTY); - } - - public void unregister(AtomicComponent component) { - // FIXME should this component be destroyed already or do we need to stop it? - instanceWrappers.remove(component); - super.unregister(component); - } - - public synchronized void stop() { - super.stop(); - instanceWrappers.clear(); - } - - public InstanceWrapper getWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - assert instanceWrappers.containsKey(component); - @SuppressWarnings("unchecked") - InstanceWrapper wrapper = (InstanceWrapper) instanceWrappers.get(component); - if (wrapper == EMPTY) { - // FIXME is there a potential race condition here that may result in two instances being created - wrapper = createInstance(component); - instanceWrappers.put(component, wrapper); - wrapper.start(); - destroyQueues.get(contextId).add(wrapper); - } - return wrapper; - } - - public InstanceWrapper getAssociatedWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - assert instanceWrappers.containsKey(component); - @SuppressWarnings("unchecked") - InstanceWrapper wrapper = (InstanceWrapper) instanceWrappers.get(component); - if (wrapper == EMPTY) { - throw new TargetNotFoundException(component.getUri().toString()); - } - return wrapper; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java deleted file mode 100644 index 2d9d3d938c..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.PersistenceException; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.store.Store; -import org.apache.tuscany.spi.services.store.StoreExpirationEvent; -import org.apache.tuscany.spi.services.store.StoreReadException; -import org.apache.tuscany.spi.services.store.StoreWriteException; - -/** - * A scope context which manages atomic component instances keyed on a conversation session - * - * @version $Rev: 452655 $ $Date: 2006-10-03 18:09:02 -0400 (Tue, 03 Oct 2006) $ - */ -public class ConversationalScopeContainer extends AbstractScopeContainer implements ScopeContainer { - private final WorkContext workContext; - private final Store nonDurableStore; - - public ConversationalScopeContainer(Store store, WorkContext workContext, final ScopeContainerMonitor monitor) { - super(Scope.CONVERSATION, monitor); - this.workContext = workContext; - this.nonDurableStore = store; - if (store != null) { - store.addListener(new ExpirationListener(monitor)); - } - } - - public void onEvent(Event event) { - checkInit(); - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); - } - lifecycleState = RUNNING; - } - - public synchronized void stop() { - lifecycleState = STOPPED; - } - - public void register(AtomicComponent component, URI groupId) { - super.register(component, groupId); - component.addListener(this); - } - - public void unregister(AtomicComponent component) { - // FIXME should all the instances associated with this component be remove already - component.removeListener(this); - super.unregister(component); - } - - public void persistNew(AtomicComponent component, String id, Object instance, long expiration) - throws PersistenceException { - try { - nonDurableStore.insertRecord(component, id, instance, expiration); - } catch (StoreWriteException e) { - throw new PersistenceException(e); - } - } - - public void persist(AtomicComponent component, String id, Object instance, long expiration) - throws PersistenceException { - try { - nonDurableStore.updateRecord(component, id, instance, expiration); - } catch (StoreWriteException e) { - throw new PersistenceException(e); - } - } - - public void remove(AtomicComponent component) throws PersistenceException { - String conversationId = getConversationId(); - try { - workContext.setCurrentAtomicComponent(component); - // FIXME this should be an InstanceWrapper and shouldn't we stop it? - Object instance = nonDurableStore.readRecord(component, conversationId); - if (instance != null) { - nonDurableStore.removeRecord(component, conversationId); - } - } catch (StoreReadException e) { - throw new PersistenceException(e); - } catch (StoreWriteException e) { - throw new PersistenceException(e); - } - } - - protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) - throws TargetResolutionException { - String conversationId = getConversationId(); - try { - workContext.setCurrentAtomicComponent(component); - InstanceWrapper wrapper = (InstanceWrapper) nonDurableStore.readRecord(component, conversationId); - if (wrapper != null) { - if (component.getMaxIdleTime() > 0) { - // update expiration - long expire = System.currentTimeMillis() + component.getMaxIdleTime(); - nonDurableStore.updateRecord(component, conversationId, wrapper, expire); - } - } else if (create) { - // FIXME should the store really be persisting the wrappers - wrapper = component.createInstanceWrapper(); - wrapper.start(); - long expire = calculateExpiration(component); - nonDurableStore.insertRecord(component, conversationId, wrapper, expire); - } - return wrapper; - } catch (StoreReadException e) { - throw new TargetResolutionException("Error retrieving target instance", e); - } catch (StoreWriteException e) { - throw new TargetResolutionException("Error persisting target instance", e); - } finally { - workContext.setCurrentAtomicComponent(null); - } - } - - /** - * Returns the conversation id associated with the current invocation context - * @return the conversation id - */ - private String getConversationId() { - String conversationId = (String) workContext.getIdentifier(Scope.CONVERSATION); - assert conversationId != null; - return conversationId; - } - - private long calculateExpiration(AtomicComponent component) { - if (component.getMaxAge() > 0) { - long now = System.currentTimeMillis(); - return now + component.getMaxAge(); - } else if (component.getMaxIdleTime() > 0) { - long now = System.currentTimeMillis(); - return now + component.getMaxIdleTime(); - } else { - return Store.DEFAULT_EXPIRATION_OFFSET; - } - } - - /** - * Receives expiration events from the store and notifies the corresponding atomic component - */ - private static class ExpirationListener implements RuntimeEventListener { - private final ScopeContainerMonitor monitor; - - public ExpirationListener(ScopeContainerMonitor monitor) { - this.monitor = monitor; - } - - public void onEvent(Event event) { - if (event instanceof StoreExpirationEvent) { - StoreExpirationEvent expiration = (StoreExpirationEvent) event; - InstanceWrapper wrapper = (InstanceWrapper) expiration.getInstance(); - try { - wrapper.stop(); - } catch (TargetDestructionException e) { - monitor.destructionError(e); - } - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java deleted file mode 100644 index 5a398e921e..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.model.Scope; - -import org.apache.tuscany.core.component.event.HttpSessionEnd; - -/** - * A scope context which manages atomic component instances keyed on HTTP session - * - * @version $Rev$ $Date$ - */ -public class HttpSessionScopeContainer extends AbstractScopeContainer { - private final WorkContext workContext; - private final Map> contexts; - private final Map> destroyQueues; - - public HttpSessionScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) { - super(Scope.SESSION, monitor); - this.workContext = workContext; - contexts = new ConcurrentHashMap>(); - destroyQueues = new ConcurrentHashMap>(); - } - - public void onEvent(Event event) { - checkInit(); - if (event instanceof HttpSessionEnd) { - Object key = ((HttpSessionEnd) event).getId(); - shutdownInstances(key); - workContext.clearIdentifier(key); - } - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); - } - lifecycleState = RUNNING; - } - - public synchronized void stop() { - contexts.clear(); - synchronized (destroyQueues) { - destroyQueues.clear(); - } - lifecycleState = STOPPED; - } - - public void register(AtomicComponent component, Object groupId) { - contexts.put(component, new ConcurrentHashMap()); - component.addListener(this); - } - - public void unregister(AtomicComponent component) { - // FIXME should all the instances associated with this component be destroyed already - contexts.remove(component); - component.removeListener(this); - super.unregister(component); - } - - protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) - throws TargetResolutionException { - Object key = workContext.getIdentifier(Scope.SESSION); - assert key != null : "HTTP session key not bound in work context"; - return getInstance(component, key, create); - } - - private InstanceWrapper getInstance(AtomicComponent component, Object key, boolean create) - throws TargetResolutionException { - Map wrappers = contexts.get(component); - InstanceWrapper ctx = wrappers.get(key); - if (ctx == null && !create) { - return null; - } - if (ctx == null) { - ctx = component.createInstanceWrapper(); - ctx.start(); - wrappers.put(key, ctx); - List destroyQueue = destroyQueues.get(key); - if (destroyQueue == null) { - destroyQueue = new ArrayList(); - destroyQueues.put(key, destroyQueue); - } - synchronized (destroyQueue) { - destroyQueue.add(ctx); - } - } - return ctx; - - } - - private void shutdownInstances(Object key) { - List destroyQueue = destroyQueues.remove(key); - if (destroyQueue != null) { - for (Map map : contexts.values()) { - map.remove(key); - } - ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); - synchronized (destroyQueue) { - while (iter.hasPrevious()) { - try { - iter.previous().stop(); - } catch (TargetDestructionException e) { - monitor.destructionError(e); - } - } - } - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java deleted file mode 100644 index def862fa7c..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetInitializationException; -import org.apache.tuscany.spi.component.InstanceWrapper; - -/** - * @version $Rev$ $Date$ - */ -public class InstanceWrapperBase implements InstanceWrapper { - protected final T instance; - private boolean started; - - public InstanceWrapperBase(T instance) { - assert instance != null; - this.instance = instance; - } - - public T getInstance() { - assert started; - return instance; - } - - public boolean isStarted() { - return started; - } - - public void start() throws TargetInitializationException { - started = true; - } - - public void stop() throws TargetDestructionException { - started = false; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java deleted file mode 100644 index d40277dc23..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.model.Scope; - -import org.apache.tuscany.core.component.event.RequestEnd; - -/** - * A scope context which manages atomic component instances keyed on the current request context - * - * @version $Rev$ $Date$ - */ -public class RequestScopeContainer extends AbstractScopeContainer { - private final Map> contexts; - private final Map> destroyQueues; - - public RequestScopeContainer(ScopeContainerMonitor monitor) { - super(Scope.REQUEST, monitor); - contexts = new ConcurrentHashMap>(); - destroyQueues = new ConcurrentHashMap>(); - } - - public void onEvent(Event event) { - checkInit(); - if (event instanceof RequestEnd) { - shutdownInstances(Thread.currentThread()); - } - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); - } - lifecycleState = RUNNING; - } - - public synchronized void stop() { - contexts.clear(); - synchronized (destroyQueues) { - destroyQueues.clear(); - } - lifecycleState = STOPPED; - } - - public void register(AtomicComponent component, URI groupId) { - super.register(component, groupId); - contexts.put(component, new ConcurrentHashMap()); - } - - public void unregister(AtomicComponent component) { - // FIXME should all the instances associated with this component be destroyed already - contexts.remove(component); - super.unregister(component); - } - - protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) - throws TargetResolutionException { - Map instanceContextMap = contexts.get(component); - assert instanceContextMap != null : "Atomic component not registered"; - InstanceWrapper ctx = instanceContextMap.get(Thread.currentThread()); - if (ctx == null && !create) { - return null; - } - if (ctx == null) { - ctx = component.createInstanceWrapper(); - ctx.start(); - instanceContextMap.put(Thread.currentThread(), ctx); - List destroyQueue = destroyQueues.get(Thread.currentThread()); - if (destroyQueue == null) { - destroyQueue = new ArrayList(); - destroyQueues.put(Thread.currentThread(), destroyQueue); - } - synchronized (destroyQueue) { - destroyQueue.add(ctx); - } - } - return ctx; - } - - private void shutdownInstances(Thread key) { - List destroyQueue = destroyQueues.remove(key); - if (destroyQueue != null && destroyQueue.size() > 0) { - Thread thread = Thread.currentThread(); - for (Map map : contexts.values()) { - map.remove(thread); - } - ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); - synchronized (destroyQueue) { - while (iter.hasPrevious()) { - try { - iter.previous().stop(); - } catch (TargetDestructionException e) { - monitor.destructionError(e); - } - } - } - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java deleted file mode 100644 index bcf05982eb..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.model.Scope; - -/** - * The default implementation of a scope registry - * - * @version $Rev$ $Date$ - */ -public class ScopeRegistryImpl implements ScopeRegistry { - private final Map scopeCache = - new ConcurrentHashMap(); - private final Map> factoryCache = - new ConcurrentHashMap>(); - - public void register(ScopeContainer container) { - scopeCache.put(container.getScope(), container); - } - - public ScopeContainer getScopeContainer(Scope scope) { - return scopeCache.get(scope); - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java deleted file mode 100644 index 0e1d5cab6a..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Service; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.api.annotation.Monitor; - -/** - * A scope context which manages stateless atomic component instances in a non-pooled fashion. - * - * @version $Rev$ $Date$ - */ -@EagerInit -@Service(ScopeContainer.class) -public class StatelessScopeContainer extends AbstractScopeContainer { - - public StatelessScopeContainer(@Monitor ScopeContainerMonitor monitor) { - super(Scope.STATELESS, monitor); - } - - public InstanceWrapper getWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - InstanceWrapper ctx = createInstance(component); - ctx.start(); - return ctx; - } - - public InstanceWrapper getAssociatedWrapper(AtomicComponent component, KEY contextId) - throws TargetResolutionException { - throw new UnsupportedOperationException(); - } - - public void returnWrapper(AtomicComponent component, InstanceWrapper wrapper, KEY contextId) - throws TargetDestructionException { - wrapper.stop(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java deleted file mode 100644 index 8d24047781..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.deployer; - -import java.net.URI; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * Base class for DeploymentContext implementations. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractDeploymentContext implements DeploymentContext { - private final URI componentId; - private boolean autowire; - private final ClassLoader classLoader; - private final URL scdlLocation; - private final Map components = new HashMap(); - - /** - * Constructor defining properties of this context. - * - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param autowire if autowire is enabled - */ - protected AbstractDeploymentContext(ClassLoader classLoader, URL scdlLocation, URI componentId, boolean autowire) { - this.classLoader = classLoader; - this.scdlLocation = scdlLocation; - this.componentId = componentId; - this.autowire = autowire; - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public URL getScdlLocation() { - return scdlLocation; - } - - public URI getComponentId() { - return componentId; - } - - public boolean isAutowire() { - return autowire; - } - - public void setAutowire(boolean autowire) { - this.autowire = autowire; - } - - @Deprecated - public Map getComponents() { - return components; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java deleted file mode 100644 index c2f8ae07fc..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.deployer; - -import java.net.URI; -import java.net.URL; -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * An holder that can be used during the load process to store information that is not part of the logical assembly - * model. This should be regarded as transient and references to this context should not be stored inside the model. - * - * @version $Rev$ $Date$ - */ -public class ChildDeploymentContext extends AbstractDeploymentContext { - private final DeploymentContext parent; - - /** - * Constructor defining properties of this context. - * - * @param parent the parent of this context - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param autowire if autowire is enabled - */ - public ChildDeploymentContext(DeploymentContext parent, - ClassLoader classLoader, - URL scdlLocation, - URI componentId, - boolean autowire) { - super(classLoader, scdlLocation, componentId, autowire); - assert parent != null; - this.parent = parent; - } - - public DeploymentContext getParent() { - return parent; - } - - public XMLInputFactory getXmlFactory() { - return parent.getXmlFactory(); - } - - public ScopeContainer getCompositeScope() { - return parent.getCompositeScope(); - } - - public URI getGroupId() { - return parent.getGroupId(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java deleted file mode 100644 index 18f078e4f6..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.deployer; - -import java.net.URI; -import java.util.Collection; -import javax.xml.stream.XMLInputFactory; - -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.api.annotation.Monitor; -import org.apache.tuscany.core.resolver.AutowireResolver; -import org.apache.tuscany.spi.builder.Builder; -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.BuilderInstantiationException; -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.deployer.Deployer; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.loader.Loader; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * Default implementation of Deployer. - * - * @version $Rev$ $Date$ - */ -public class DeployerImpl implements Deployer { - private XMLInputFactory xmlFactory; - private Loader loader; - private Builder builder; - private ScopeContainerMonitor monitor; - private AutowireResolver resolver; - private Connector connector; - private ComponentManager componentManager; - private ScopeRegistry scopeRegistry; - - - public DeployerImpl(XMLInputFactory xmlFactory, - Loader loader, - Builder builder, - ComponentManager componentManager, - AutowireResolver resolver, - Connector connector) { - this.xmlFactory = xmlFactory; - this.builder = builder; - this.loader = loader; - this.componentManager = componentManager; - this.resolver = resolver; - this.connector = connector; - } - - public DeployerImpl() { - xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader()); - } - - @Reference - public void setBuilder(BuilderRegistry builder) { - this.builder = builder; - } - - @Monitor - public void setMonitor(ScopeContainerMonitor monitor) { - this.monitor = monitor; - } - - @Reference - public void setResolver(AutowireResolver resolver) { - this.resolver = resolver; - } - - @Reference - public void setConnector(Connector connector) { - this.connector = connector; - } - - @Reference - public void setComponentManager(ComponentManager componentManager) { - this.componentManager = componentManager; - } - - @Reference - public void setScopeRegistry(ScopeRegistry scopeRegistry) { - this.scopeRegistry = scopeRegistry; - } - - public > Collection deploy(Component parent, - ComponentDefinition componentDefinition) - throws LoaderException, BuilderException, ResolutionException { - @SuppressWarnings("unchecked") - ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(Scope.COMPOSITE); - URI groupId = componentDefinition.getUri(); - DeploymentContext deploymentContext = - new RootDeploymentContext(null, null, groupId, xmlFactory, scopeContainer, false); - // load the model - load(parent, componentDefinition, deploymentContext); - // resolve autowires - resolver.resolve(null, componentDefinition); - // build runtime artifacts - build(parent, componentDefinition, deploymentContext); -/* - // create a listener so the scope container is shutdown when the top-level composite stops - RuntimeEventListener listener = new RuntimeEventListener() { - public void onEvent(Event event) { - scopeContainer.onEvent(event); - if (event instanceof ComponentStop) { - scopeContainer.stop(); - } - } - }; - component.addListener(listener); -*/ - - Collection components = deploymentContext.getComponents().values(); - for (Component toRegister : components) { - try { - componentManager.register(toRegister); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering component", e); - } - } - connector.connect(componentDefinition); - return components; - } - - /** - * Load the componentDefinition type information for the componentDefinition being deployed. For a typical - * deployment this will result in the SCDL definition being loaded. - * - * @param componentDefinition the componentDefinition being deployed - * @param deploymentContext the current deployment context - */ - protected > void load(Component parent, - ComponentDefinition componentDefinition, - DeploymentContext deploymentContext) throws LoaderException { - loader.loadComponentType(componentDefinition.getImplementation(), deploymentContext); - } - - - /** - * Build the runtime context for a loaded componentDefinition. - * - * @param parent the context that will be the parent of the new sub-context - * @param componentDefinition the componentDefinition being deployed - * @param deploymentContext the current deployment context - * @return the new runtime context - */ - protected > SCAObject build(Component parent, - ComponentDefinition componentDefinition, - DeploymentContext deploymentContext) - throws BuilderException { - return builder.build(componentDefinition, deploymentContext); - } - - /** - * @return the builder - */ - public Builder getBuilder() { - return builder; - } - - /** - * @return the loader - */ - public Loader getLoader() { - return loader; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java deleted file mode 100644 index a523dadbf4..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.deployer; - -import java.net.URI; -import java.net.URL; -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * A holder that can be used during the load process to store information that is not part of the logical assembly - * model. This should be regarded as transient and references to this context should not be stored inside the model. - * - * @version $Rev$ $Date$ - */ -public class RootDeploymentContext extends AbstractDeploymentContext { - private final XMLInputFactory xmlFactory; - private final ScopeContainer scopeContainer; - - /** - * Constructor defining properties of this context. - * - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param xmlFactory a factory that can be used to obtain an StAX XMLStreamReader - * @param scopeContainer the scope context representing this deployment's COMPOSITE scope - * @param autowire if autowire is enabled - */ - public RootDeploymentContext(ClassLoader classLoader, - URL scdlLocation, - URI componentId, - XMLInputFactory xmlFactory, - ScopeContainer scopeContainer, - boolean autowire) { - super(classLoader, scdlLocation, componentId, autowire); - this.xmlFactory = xmlFactory; - this.scopeContainer = scopeContainer; - } - - public DeploymentContext getParent() { - return null; - } - - public XMLInputFactory getXmlFactory() { - return xmlFactory; - } - - public ScopeContainer getCompositeScope() { - return scopeContainer; - } - - public URI getGroupId() { - return getComponentId(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/PojoWorkContextTunnel.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/PojoWorkContextTunnel.java deleted file mode 100644 index cef6675f05..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/PojoWorkContextTunnel.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation; - -import org.apache.tuscany.spi.component.WorkContext; - -/** - * Class for tunneling a WorkContext through the invocation of a user class. - * - * @version $Rev$ $Date$ - */ -public final class PojoWorkContextTunnel { - private PojoWorkContextTunnel() { - } - - private static final ThreadLocal CONTEXT = new ThreadLocal(); - - /** - * Set the WorkContext for the current thread. - * The current work context is returned and must be restored after the invocation is complete. - * Typical usage would be: - *
-     *   WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
-     *   try {
-     *      ... invoke user code ...
-     *   } finally {
-     *     PojoWorkContextTunnel.setThreadWorkContext(old);
-     *   }
-     * 
- * @param context - * @return the current work context for the thread; this must be restored after the invocation is made - */ - public static WorkContext setThreadWorkContext(WorkContext context) { - WorkContext old = CONTEXT.get(); - CONTEXT.set(context); - return old; - } - - /** - * Returns the WorkContext for the current thread. - * - * @return the WorkContext for the current thread - */ - public static WorkContext getThreadWorkContext() { - return CONTEXT.get(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java deleted file mode 100644 index d12b407ea7..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.BuilderInstantiationException; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.ComponentBuilderExtension; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceDefinition; - -/** - * Abstract builder for composites - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractCompositeBuilder> - extends ComponentBuilderExtension { - - public Component build( - Component component, - CompositeComponentType componentType, - DeploymentContext deploymentContext) throws BuilderException { - for (ComponentDefinition> definition : componentType.getComponents().values()) { - builderRegistry.build(definition, deploymentContext); - } - for (ServiceDefinition definition : componentType.getServices().values()) { - try { - Service service = builderRegistry.build(definition, deploymentContext); - component.register(service); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering service", e); - } - } - for (ReferenceDefinition definition : componentType.getReferences().values()) { - try { - Reference reference = builderRegistry.build(definition, deploymentContext); - component.register(reference); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering reference", e); - } - } - return component; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java deleted file mode 100644 index ed64cb1236..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import org.apache.tuscany.spi.component.ComponentRuntimeException; - -/** - * Denotes a condition where a component times out waiting to perform an operation - * - * @version $Rev$ $Date$ - */ -public class ComponentTimeoutException extends ComponentRuntimeException { - - public ComponentTimeoutException(String message) { - super(message); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java deleted file mode 100644 index 51d360ec39..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; - -/** - * Instantiates a composite component from an assembly definition - * - * @version $Rev$ $Date$ - */ -public class CompositeBuilder extends AbstractCompositeBuilder { - - public Component build(ComponentDefinition componentDefinition, - DeploymentContext deploymentContext) throws BuilderException { - - CompositeImplementation implementation = componentDefinition.getImplementation(); - CompositeComponentType componentType = implementation.getComponentType(); - URI name = componentDefinition.getUri(); - CompositeComponentImpl component = new CompositeComponentImpl(name); - - return build(component, componentType, deploymentContext); - } - - protected Class getImplementationType() { - return CompositeImplementation.class; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java deleted file mode 100644 index 8df05048c8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.extension.CompositeComponentExtension; -import org.apache.tuscany.spi.wire.Wire; - -import org.apache.tuscany.core.component.event.ComponentStop; - -/** - * The standard implementation of a composite component. Autowiring is performed by delegating to the parent composite. - * - * @version $Rev$ $Date$ - */ -public class CompositeComponentImpl extends CompositeComponentExtension { - public static final int DEFAULT_WAIT = 1000 * 60; - // Blocking latch to ensure the composite is initialized exactly once prior to servicing requests - protected CountDownLatch initializeLatch = new CountDownLatch(1); - protected final Object lock = new Object(); - // Indicates whether the composite context has been initialized - protected boolean initialized; - - /** - * Constructor - * - * @param name the name of this Component - */ - public CompositeComponentImpl(URI name) { - super(name); - } - - public void attachWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public void attachWires(List wires) { - throw new UnsupportedOperationException(); - } - - public List getWires(String name) { - throw new UnsupportedOperationException(); - } - - public void attachCallbackWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public void start() { - synchronized (lock) { - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Composite not in UNINITIALIZED state"); - } - initializeLatch.countDown(); - initialized = true; - lifecycleState = INITIALIZED; - } - } - - public void stop() { - if (lifecycleState == STOPPED) { - return; - } - - publish(new ComponentStop(this, getUri())); - // need to block a start until reset is complete - initializeLatch = new CountDownLatch(2); - lifecycleState = STOPPING; - initialized = false; - // allow initialized to be called - initializeLatch.countDown(); - lifecycleState = STOPPED; - } - - public void publish(Event event) { - if (lifecycleState == STOPPED) { - return; - } - checkInit(); - super.publish(event); - } - - /** - * Blocks until the composite context has been initialized - */ - protected void checkInit() throws ComponentTimeoutException { - if (!initialized) { - try { - /* block until the composite has initialized */ - boolean success = initializeLatch.await(DEFAULT_WAIT, TimeUnit.MILLISECONDS); - if (!success) { - throw new ComponentTimeoutException("Timeout waiting for context to initialize"); - } - } catch (InterruptedException e) { // should not happen - } - } - - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java deleted file mode 100644 index 6cb31a8e20..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; -import java.net.URL; - -import org.apache.tuscany.spi.deployer.CompositeClassLoader; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; - -import org.apache.tuscany.core.deployer.ChildDeploymentContext; - -/** - * Loads a composite component type - * - * @version $Rev$ $Date$ - */ -public class CompositeComponentTypeLoader extends ComponentTypeLoaderExtension { - public CompositeComponentTypeLoader() { - } - - public CompositeComponentTypeLoader(LoaderRegistry loaderRegistry) { - super(loaderRegistry); - } - - protected Class getImplementationClass() { - return CompositeImplementation.class; - } - - public void load(CompositeImplementation implementation, DeploymentContext context) throws LoaderException { - URL scdlLocation = implementation.getScdlLocation(); - ClassLoader cl = new CompositeClassLoader(null, implementation.getClassLoader()); - URI componentId = URI.create(context.getComponentId().toString() + '/'); - DeploymentContext childContext = - new ChildDeploymentContext(context, cl, scdlLocation, componentId, context.isAutowire()); - CompositeComponentType componentType = loadFromSidefile(scdlLocation, childContext); - implementation.setComponentType(componentType); - } - - protected CompositeComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) - throws LoaderException { - return loaderRegistry.load(null, url, CompositeComponentType.class, deploymentContext); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java deleted file mode 100644 index 008ee59de8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import static org.osoa.sca.Constants.SCA_NS; - -import java.net.URI; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.InvalidServiceException; -import org.apache.tuscany.spi.loader.InvalidWireException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.Include; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.apache.tuscany.spi.model.WireDefinition; -import org.apache.tuscany.spi.services.artifact.ArtifactRepository; -import org.osoa.sca.annotations.Reference; - -/** - * Loads a composite component definition from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class CompositeLoader extends LoaderExtension { - public static final QName COMPOSITE = new QName(SCA_NS, "composite"); - public static final String URI_DELIMITER = "/"; - - private final ArtifactRepository artifactRepository; - - public CompositeLoader(@Reference - LoaderRegistry registry, @Reference - ArtifactRepository artifactRepository) { - super(registry); - this.artifactRepository = artifactRepository; - } - - public QName getXMLType() { - return COMPOSITE; - } - - public CompositeComponentType load(ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException, LoaderException { - - String name = reader.getAttributeValue(null, "name"); - String targetNamespace = reader.getAttributeValue(null, "targetNamespace"); - boolean autowire = Boolean.parseBoolean(reader.getAttributeValue(null, "autowire")); - - CompositeComponentType> type = new CompositeComponentType>( - new QName( - targetNamespace, - name)); - type.setAutowire(autowire); - boolean done = false; - while (!done) { - switch (reader.next()) { - case START_ELEMENT: - boolean oldAutowire = deploymentContext.isAutowire(); - deploymentContext.setAutowire(autowire); - ModelObject o = registry.load(type, reader, deploymentContext); - deploymentContext.setAutowire(oldAutowire); - if (o instanceof ServiceDefinition) { - type.add((ServiceDefinition)o); - } else if (o instanceof ReferenceDefinition) { - type.add((ReferenceDefinition)o); - } else if (o instanceof Property) { - type.add((Property)o); - } else if (o instanceof ComponentDefinition) { - type.add((ComponentDefinition)o); - } else if (o instanceof Include) { - type.add((Include)o); - } else if (o instanceof WireDefinition) { - type.add((WireDefinition)o); - } else { - // add as an unknown model extension - if (o != null) { - type.getExtensions().put(o.getClass(), o); - } - } - reader.next(); - break; - case END_ELEMENT: - if (COMPOSITE.equals(reader.getName())) { - // if there are wire defintions then link them up to the - // relevant components - resolveWires(type); - verifyCompositeCompleteness(type); - done = true; - break; - } - } - } - for (ComponentDefinition> c : type.getComponents().values()) { - // PropertyHelper.processProperties(type, c, deploymentContext); - } - return type; - } - - protected void resolveWires(CompositeComponentType> composite) - throws InvalidWireException { - ComponentDefinition componentDefinition; - ServiceDefinition serviceDefinition; - List wireDefns = composite.getDeclaredWires(); - for (WireDefinition wire : wireDefns) { - URI targetUri = wire.getTarget(); - // validate the target before finding the source - validateTarget(targetUri, composite); - - String sourceName = wire.getSource().getPath(); // new - // QualifiedName(wire.getSource().getPath()); - serviceDefinition = composite.getDeclaredServices().get(sourceName); - if (serviceDefinition != null) { - serviceDefinition.setTarget(wire.getTarget()); - } else { - componentDefinition = composite.getDeclaredComponents().get(sourceName); - if (componentDefinition != null) { - if (wire.getSource().getFragment() == null) { - throw new InvalidWireException("Source reference not specified", sourceName); - } - URI referenceName = URI.create(wire.getSource().getFragment()); - ReferenceTarget referenceTarget = createReferenceTarget(referenceName, - targetUri, - componentDefinition); - componentDefinition.add(referenceTarget); - } else { - throw new InvalidWireException("Source not found", sourceName); - } - } - } - } - - private ReferenceTarget createReferenceTarget(URI componentReferenceName, - URI target, - ComponentDefinition componentDefn) throws InvalidWireException { - ComponentType componentType = componentDefn.getImplementation().getComponentType(); - if (componentReferenceName == null) { - // if there is ambiguity in determining the source of the wire or - // there is no reference to be wired - if (componentType.getReferences().size() > 1 || componentType.getReferences().isEmpty()) { - throw new InvalidWireException("Unable to determine unique source reference"); - } else { - Map references = componentType.getReferences(); - ReferenceDefinition definition = (ReferenceDefinition)references.values().iterator().next(); - componentReferenceName = definition.getUri(); - } - } - - ReferenceTarget referenceTarget = new ReferenceTarget(); - referenceTarget.setReferenceName(componentReferenceName); - referenceTarget.addTarget(target); - return referenceTarget; - } - - protected void verifyCompositeCompleteness(CompositeComponentType> composite) - throws InvalidServiceException { - // check if all of the composite services have been wired - for (ServiceDefinition svcDefn : composite.getDeclaredServices().values()) { - if (svcDefn.getTarget() == null) { - String identifier = svcDefn.getUri().toString(); - throw new InvalidServiceException("Composite service not wired to a target", identifier); - } - } - } - - private void validateTarget(URI target, - CompositeComponentType> composite) - throws InvalidWireException { - // if target is not a reference of the composite - String targetName = target.getPath(); - if (composite.getReferences().get(targetName) == null) { - ComponentDefinition targetDefinition = composite.getDeclaredComponents().get(targetName); - // if a target component exists in this composite - if (targetDefinition != null) { - Implementation implementation = targetDefinition.getImplementation(); - ComponentType componentType = implementation.getComponentType(); - Map services = componentType.getServices(); - if (target.getFragment() == null) { - if (services.size() > 1 || services.isEmpty()) { - throw new InvalidWireException("Ambiguous target", target.toString()); - } - } else { - if (services.get(target.getFragment()) == null) { - throw new InvalidWireException("Invalid target service", target.toString()); - } - } - } else { - throw new InvalidWireException("Target not found", target.toString()); - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java deleted file mode 100644 index f2a8109ee3..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import javax.security.auth.Subject; - -import org.osoa.sca.RequestContext; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.CallableReference; - -import org.apache.tuscany.spi.component.WorkContext; - -/** - * @version $Rev$ $Date$ - */ -public class ManagedRequestContext implements RequestContext { - private WorkContext workContext; - - public ManagedRequestContext(WorkContext workContext) { - this.workContext = workContext; - } - - public Subject getSecuritySubject() { - throw new UnsupportedOperationException(); - } - - public String getServiceName() { - return workContext.getCurrentServiceName(); - } - - public ServiceReference getServiceReference() { - throw new UnsupportedOperationException(); - } - - public CB getCallback() { - throw new UnsupportedOperationException(); - } - - public CallableReference getCallbackReference() { - throw new UnsupportedOperationException(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java deleted file mode 100644 index f824980f29..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.spi.component.AbstractSCAObject; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * The default implementation of a {@link org.apache.tuscany.spi.component.Reference} - * - * @version $Rev$ $Date$ - */ -public class ReferenceImpl extends AbstractSCAObject implements Reference { - private ServiceContract serviceContract; - private List bindings = new ArrayList(); - - public ReferenceImpl(URI name, ServiceContract contract) { - super(name); - this.serviceContract = contract; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public List getReferenceBindings() { - return Collections.unmodifiableList(bindings); - } - - public void addReferenceBinding(ReferenceBinding binding) { - bindings.add(binding); - } - - public void start() { - super.start(); - for (ReferenceBinding binding : bindings) { - binding.start(); - } - } - - public void stop() { - super.stop(); - for (ReferenceBinding binding : bindings) { - binding.stop(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java deleted file mode 100644 index b8b9b00b49..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.spi.component.AbstractSCAObject; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * The default implementation of a {@link Service} - * - * @version $Rev$ $Date$ - */ -public class ServiceImpl extends AbstractSCAObject implements Service { - private ServiceContract serviceContract; - private List bindings = new ArrayList(); - private URI targetUri; - - public ServiceImpl(URI name, ServiceContract contract) { - this(name, contract, null); - } - - public ServiceImpl(URI name, ServiceContract contract, URI targetUri) { - super(name); - this.serviceContract = contract; - this.targetUri = targetUri; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public URI getTargetUri() { - return targetUri; - } - - public List getServiceBindings() { - return Collections.unmodifiableList(bindings); - } - - public void addServiceBinding(ServiceBinding binding) { - bindings.add(binding); - } - - public void start() { - super.start(); - for (ServiceBinding binding : bindings) { - binding.start(); - } - } - - public void stop() { - super.stop(); - for (ServiceBinding binding : bindings) { - binding.stop(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java deleted file mode 100644 index 713c1ae54f..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.spi.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/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java deleted file mode 100644 index b289e74a9b..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import static org.osoa.sca.Constants.SCA_NS; - -import java.lang.reflect.Type; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.binding.local.LocalBindingDefinition; -import org.apache.tuscany.core.deployer.ChildDeploymentContext; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.QualifiedName; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.InvalidReferenceException; -import org.apache.tuscany.spi.loader.InvalidValueException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.LoaderUtil; -import org.apache.tuscany.spi.loader.MissingImplementationException; -import org.apache.tuscany.spi.loader.MissingReferenceException; -import org.apache.tuscany.spi.loader.MissingRequiredPropertyException; -import org.apache.tuscany.spi.loader.PropertyObjectFactory; -import org.apache.tuscany.spi.loader.ReferenceMultiplicityViolationException; -import org.apache.tuscany.spi.loader.UndefinedPropertyException; -import org.apache.tuscany.spi.loader.UndefinedReferenceException; -import org.apache.tuscany.spi.loader.UnrecognizedElementException; -import org.apache.tuscany.spi.model.BindingDefinition; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Multiplicity; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.PropertyValue; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; -import org.w3c.dom.Document; - -/** - * Loads a component definition from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class ComponentLoader extends LoaderExtension> { - private static final QName COMPONENT = new QName(SCA_NS, "component"); - private static final QName PROPERTY = new QName(SCA_NS, "property"); - private static final QName REFERENCE = new QName(SCA_NS, "reference"); - - private static final String PROPERTY_FILE_ATTR = "file"; - private static final String PROPERTY_NAME_ATTR = "name"; - private static final String PROPERTY_SOURCE_ATTR = "source"; - - private PropertyObjectFactory propertyFactory; - - @Constructor - public ComponentLoader(@Reference LoaderRegistry registry, @Reference PropertyObjectFactory propertyFactory) { - super(registry); - this.propertyFactory = propertyFactory; - } - - public QName getXMLType() { - return COMPONENT; - } - - @SuppressWarnings("unchecked") - public ComponentDefinition load(ModelObject object, XMLStreamReader reader, DeploymentContext context) - throws XMLStreamException, LoaderException { - assert COMPONENT.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - String initLevel = reader.getAttributeValue(null, "initLevel"); - String autowireAttr = reader.getAttributeValue(null, "autowire"); - boolean autowire; - if (autowireAttr == null) { - autowire = context.isAutowire(); - } else { - autowire = Boolean.parseBoolean(autowireAttr); - } - String runtimeAttr = reader.getAttributeValue(null, "runtimeId"); - URI runtimeId; - if (runtimeAttr != null) { - try { - runtimeId = new URI(runtimeAttr); - } catch (URISyntaxException e) { - throw new InvalidValueException(runtimeAttr, "runtimeId", e); - } - } else { - runtimeId = null; - } - - URI componentId = URI.create(context.getComponentId() + "/").resolve(name); - ClassLoader loader = context.getClassLoader(); - URL location = context.getScdlLocation(); - // xcv test - DeploymentContext childContext = new ChildDeploymentContext(context, loader, location, componentId, autowire); - Implementation impl = loadImplementation(reader, childContext); - registry.loadComponentType(impl, childContext); - - ComponentDefinition> componentDefinition = - new ComponentDefinition>(componentId, impl); - componentDefinition.setAutowire(autowire); - componentDefinition.setRuntimeId(runtimeId); - if (initLevel != null) { - if (initLevel.length() == 0) { - componentDefinition.setInitLevel(0); - } else { - try { - componentDefinition.setInitLevel(Integer.valueOf(initLevel)); - } catch (NumberFormatException e) { - throw new InvalidValueException(initLevel, "initValue", e); - } - } - } - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (PROPERTY.equals(qname)) { - loadProperty(reader, componentDefinition, childContext); - } else if (REFERENCE.equals(qname)) { - loadReference(reader, componentDefinition, childContext); - } else { - throw new UnrecognizedElementException(qname); - } - reader.next(); - break; - case END_ELEMENT: - if (reader.getName().equals(COMPONENT)) { - populatePropertyValues(componentDefinition); - ComponentType> type = - (ComponentType>) componentDefinition - .getImplementation().getComponentType(); - - for (ReferenceDefinition ref : type.getReferences().values()) { - // add reference target definitions if autowire is enabled for references that are not - // explicitly configured with autowire by the component - if (!componentDefinition.getReferenceTargets().containsKey(ref.getUri().getFragment())) { - if (autowire) { - ReferenceTarget referenceTarget = new ReferenceTarget(); - String compName = componentDefinition.getUri().toString(); - URI refName = URI.create(compName + ref.getUri().toString()); - referenceTarget.setReferenceName(refName); - referenceTarget.setAutowire(autowire); - componentDefinition.add(referenceTarget); - } - } - } - validate(componentDefinition); - return componentDefinition; - } - break; - } - } - } - - protected Implementation loadImplementation(XMLStreamReader reader, DeploymentContext context) - throws XMLStreamException, LoaderException { - reader.nextTag(); - ModelObject o = registry.load(null, reader, context); - if (!(o instanceof Implementation)) { - throw new MissingImplementationException(); - } - return (Implementation) o; - } - - @SuppressWarnings("unchecked") - protected void loadProperty(XMLStreamReader reader, ComponentDefinition definition, DeploymentContext context) - throws XMLStreamException, LoaderException { - String name = reader.getAttributeValue(null, PROPERTY_NAME_ATTR); - Implementation implementation = definition.getImplementation(); - ComponentType componentType = implementation.getComponentType(); - Property property = (Property) componentType.getProperties().get(name); - if (property == null) { - throw new UndefinedPropertyException(name); - } - PropertyValue propertyValue; - String source = reader.getAttributeValue(null, PROPERTY_SOURCE_ATTR); - String file = reader.getAttributeValue(null, PROPERTY_FILE_ATTR); - if (source != null || file != null) { - propertyValue = new PropertyValue(name, source, file); - propertyValue.setValue(property.getDefaultValue()); - LoaderUtil.skipToEndElement(reader); - } else { - try { - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document value = PropertyUtils.createPropertyValue(reader, property.getXmlType(), documentBuilder); - propertyValue = new PropertyValue(name, value); - } catch (ParserConfigurationException e) { - throw new LoaderException(e); - } - } - ObjectFactory objectFactory = propertyFactory.createObjectFactory(property, propertyValue); - propertyValue.setValueFactory(objectFactory); - definition.add(propertyValue); - } - - protected void loadReference(XMLStreamReader reader, - ComponentDefinition componentDefinition, - DeploymentContext context) throws XMLStreamException, LoaderException { - String name = reader.getAttributeValue(null, "name"); - if (name == null) { - throw new InvalidReferenceException("No name specified"); - } - String target = reader.getAttributeValue(null, "target"); - boolean autowire = Boolean.parseBoolean(reader.getAttributeValue(null, "autowire")); - URI componentId = context.getComponentId(); - List uris = new ArrayList(); - if (target != null) { - StringTokenizer tokenizer = new StringTokenizer(target); - while (tokenizer.hasMoreTokens()) { - String token = tokenizer.nextToken(); - QualifiedName qName = new QualifiedName(token); - uris.add(componentId.resolve(qName.getFragment())); - } - } - - Implementation impl = componentDefinition.getImplementation(); - ComponentType componentType = impl.getComponentType(); - if (!componentType.getReferences().containsKey(name)) { - throw new UndefinedReferenceException(name); - } - if (componentType instanceof CompositeComponentType) { - if (uris.size() != 1) { - // FIXME not yet implemented - throw new UnsupportedOperationException(); - } - ReferenceDefinition definition = componentType.getReferences().get(name); - if (definition.getBindings().isEmpty()) { - // TODO JFM allow selection of a default binding - LocalBindingDefinition binding = new LocalBindingDefinition(uris.get(0)); - definition.addBinding(binding); - } else { - for (BindingDefinition binding : definition.getBindings()) { - binding.setTargetUri(uris.get(0)); - } - } - } else { - ReferenceTarget referenceTarget = componentDefinition.getReferenceTargets().get(name); - if (referenceTarget == null) { - referenceTarget = new ReferenceTarget(); - referenceTarget.setReferenceName(componentId.resolve('#' + name)); - referenceTarget.setAutowire(autowire); - componentDefinition.add(referenceTarget); - } - for (URI uri : uris) { - referenceTarget.addTarget(uri); - } - } - } - - @SuppressWarnings("unchecked") - protected void populatePropertyValues(ComponentDefinition> componentDefinition) - throws MissingRequiredPropertyException { - ComponentType componentType = componentDefinition.getImplementation().getComponentType(); - if (componentType != null) { - Map> properties = componentType.getProperties(); - Map> propertyValues = componentDefinition.getPropertyValues(); - - for (Property aProperty : properties.values()) { - if (propertyValues.get(aProperty.getName()) == null) { - if (aProperty.isRequired()) { - throw new MissingRequiredPropertyException(aProperty.getName()); - } else if (aProperty.getDefaultValue() != null) { - PropertyValue propertyValue = new PropertyValue(); - propertyValue.setName(aProperty.getName()); - propertyValue.setValue(aProperty.getDefaultValue()); -// propertyValue.setValueFactory(new SimplePropertyObjectFactory(aProperty, -// propertyValue.getValue())); - propertyValues.put(aProperty.getName(), propertyValue); - } - } - } - } - } - - /** - * Validates a component definition, ensuring all component type configuration elements are satisfied - */ - protected void validate(ComponentDefinition> definition) throws LoaderException { - // validate refererences - Implementation implementation = definition.getImplementation(); - ComponentType type = implementation.getComponentType(); - if (type == null) { - return; - } - for (ReferenceDefinition referenceDef : type.getReferences().values()) { - if (!referenceDef.isRequired()) { - continue; - } - String name = referenceDef.getUri().getFragment(); - ReferenceTarget target = definition.getReferenceTargets().get(name); - if (target == null) { - throw new MissingReferenceException(name); - } - if (target.isAutowire()) { - // autowire targets are not set yet - continue; - } - int count = target.getTargets().size(); - Multiplicity multiplicity = referenceDef.getMultiplicity(); - switch (multiplicity) { - case ZERO_N: - break; - case ZERO_ONE: - if (count > 1) { - throw new ReferenceMultiplicityViolationException(name, multiplicity, count); - } - break; - case ONE_ONE: - if (count != 1) { - throw new ReferenceMultiplicityViolationException(name, multiplicity, count); - } - break; - case ONE_N: - if (count < 1) { - throw new ReferenceMultiplicityViolationException(name, multiplicity, count); - } - break; - } - - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java deleted file mode 100644 index beb0bc2731..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -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 static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceDefinition; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentTypeElementLoader extends LoaderExtension { - public static final QName COMPONENT_TYPE = new QName(SCA_NS, "componentType"); - - @Constructor - public ComponentTypeElementLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return COMPONENT_TYPE; - } - - @SuppressWarnings("unchecked") - public ComponentType load(ModelObject object, XMLStreamReader reader, DeploymentContext context) - throws XMLStreamException, LoaderException { - assert COMPONENT_TYPE.equals(reader.getName()); - ComponentType> componentType; - if (object != null) { - assert object instanceof ComponentType; - // a specialized component type was passed in - componentType = (ComponentType>) object; - } else { - componentType = new ComponentType>(); - } - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - ModelObject o = registry.load(componentType, reader, context); - if (o instanceof ServiceDefinition) { - componentType.add((ServiceDefinition) o); - } else if (o instanceof ReferenceDefinition) { - componentType.add((ReferenceDefinition) o); - } else if (o instanceof Property) { - componentType.add((Property) o); - } - break; - case END_ELEMENT: - return componentType; - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java deleted file mode 100644 index e10a93bbc0..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.LoaderUtil; -import org.apache.tuscany.spi.loader.MissingIncludeException; -import org.apache.tuscany.spi.loader.MissingResourceException; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Include; -import org.apache.tuscany.spi.model.ModelObject; - -import org.apache.tuscany.core.deployer.ChildDeploymentContext; - -/** - * Loader that handles <include> elements. - * - * @version $Rev$ $Date$ - */ -public class IncludeLoader extends LoaderExtension { - private static final QName INCLUDE = new QName(SCA_NS, "include"); - - @Constructor - public IncludeLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return INCLUDE; - } - - public Include load(ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException, LoaderException { - - assert INCLUDE.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - String scdlLocation = reader.getAttributeValue(null, "scdlLocation"); - String scdlResource = reader.getAttributeValue(null, "scdlResource"); - LoaderUtil.skipToEndElement(reader); - - ClassLoader cl = deploymentContext.getClassLoader(); - URL url; - if (scdlLocation != null) { - try { - url = new URL(deploymentContext.getScdlLocation(), scdlLocation); - } catch (MalformedURLException e) { - throw new MissingResourceException(scdlLocation, name, e); - } - } else if (scdlResource != null) { - url = cl.getResource(scdlResource); - if (url == null) { - throw new MissingResourceException(scdlResource, name); - } - } else { - throw new MissingIncludeException("No SCDL location or resource specified", name); - } - - // when we include, the componentId remains that of the parent - URI componentId = deploymentContext.getComponentId(); - boolean autowire = deploymentContext.isAutowire(); - DeploymentContext childContext = new ChildDeploymentContext(deploymentContext, cl, url, componentId, autowire); - CompositeComponentType composite; - composite = loadFromSidefile(url, childContext); - - Include include = new Include(); - include.setName(name); - include.setScdlLocation(url); - include.setIncluded(composite); - return include; - } - - protected CompositeComponentType loadFromSidefile(URL url, DeploymentContext context) throws LoaderException { - return registry.load(null, url, CompositeComponentType.class, context); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java deleted file mode 100644 index 26ec72ecb6..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.io.PrintWriter; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.loader.LoaderException; - -import org.apache.tuscany.host.monitor.ExceptionFormatter; -import org.apache.tuscany.host.monitor.FormatterRegistry; - -/** - * Formats {@link org.apache.tuscany.spi.loader.LoaderException} events - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class LoaderExceptionFormatter implements ExceptionFormatter { - private FormatterRegistry factory; - - public LoaderExceptionFormatter(@Reference FormatterRegistry factory) { - this.factory = factory; - factory.register(this); - } - - public boolean canFormat(Class type) { - return LoaderException.class.isAssignableFrom(type); - } - - @Destroy - public void destroy() { - factory.unregister(this); - } - - public PrintWriter write(PrintWriter writer, Throwable exception) { - assert exception instanceof LoaderException; - LoaderException e = (LoaderException) exception; - e.appendBaseMessage(writer); - if (e.getLine() != LoaderException.UNDEFINED) { - writer.write("\nLine: " + e.getLine() + "\n"); - writer.write("Column: " + e.getColumn() + "\n"); - } else { - writer.write("\n"); - } - return writer; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java deleted file mode 100644 index 57fd1da870..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import javax.xml.namespace.QName; -import javax.xml.stream.Location; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.osoa.sca.annotations.EagerInit; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.loader.ComponentTypeLoader; -import org.apache.tuscany.spi.loader.InvalidConfigurationException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.StAXElementLoader; -import org.apache.tuscany.spi.loader.UnrecognizedComponentTypeException; -import org.apache.tuscany.spi.loader.UnrecognizedElementException; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ModelObject; - -/** - * The default implementation of a loader registry - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class LoaderRegistryImpl implements LoaderRegistry { - private Monitor monitor; - private final Map> loaders = - new HashMap>(); - private final Map>, - ComponentTypeLoader>> componentTypeLoaders = - new HashMap>, ComponentTypeLoader>>(); - - public LoaderRegistryImpl(@org.apache.tuscany.api.annotation.Monitor 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 ModelObject load( - ModelObject object, - XMLStreamReader reader, - DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - QName name = reader.getName(); - monitor.elementLoad(name); - StAXElementLoader loader = loaders.get(name); - if (loader == null) { - throw new UnrecognizedElementException(name); - } - return loader.load(object, reader, deploymentContext); - } - - public MO load( - ModelObject object, - URL url, - Class type, - DeploymentContext ctx) throws LoaderException { - try { - XMLStreamReader reader; - InputStream is; - is = url.openStream(); - try { - XMLInputFactory factory = ctx.getXmlFactory(); - reader = factory.createXMLStreamReader(is); - try { - reader.nextTag(); - QName name = reader.getName(); - ModelObject mo = load(object, reader, ctx); - if (type.isInstance(mo)) { - return type.cast(mo); - } else { - UnrecognizedElementException e = new UnrecognizedElementException(name); - e.setResourceURI(url.toString()); - throw e; - } - } catch (LoaderException e) { - Location location = reader.getLocation(); - e.setLine(location.getLineNumber()); - e.setColumn(location.getColumnNumber()); - throw e; - } finally { - try { - reader.close(); - } catch (XMLStreamException e) { - // ignore - } - } - } finally { - try { - is.close(); - } catch (IOException e) { - // ignore - } - } - } catch (IOException e) { - LoaderException sfe = new LoaderException(e); - sfe.setResourceURI(url.toString()); - throw sfe; - } catch (XMLStreamException e) { - throw new InvalidConfigurationException("Invalid or missing resource", url.toString(), e); - } - } - - public > void registerLoader(Class key, ComponentTypeLoader loader) { - componentTypeLoaders.put(key, loader); - } - - public > void unregisterLoader(Class key) { - componentTypeLoaders.remove(key); - } - - @SuppressWarnings("unchecked") - public > void loadComponentType(I implementation, - DeploymentContext deploymentContext) - throws LoaderException { - Class key = (Class) implementation.getClass(); - ComponentTypeLoader loader = (ComponentTypeLoader) componentTypeLoaders.get(key); - if (loader == null) { - throw new UnrecognizedComponentTypeException(key); - } - loader.load(implementation, deploymentContext); - } - - 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/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java deleted file mode 100644 index 66d2a87593..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.util.ArrayList; -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 static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.LoaderUtil; -import org.apache.tuscany.spi.model.IntentMap; -import org.apache.tuscany.spi.model.IntentName; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.PolicySet; -import org.apache.tuscany.spi.model.PolicySetReference; -import org.apache.tuscany.spi.model.Qualifier; -import org.apache.tuscany.spi.model.WSPolicyAttachment; - -/** - * Loads a PolicySet definition from an SCDL file. - * - * @version $Rev$ $Date$ - */ -public class PolicySetLoader extends LoaderExtension { - - private static final String WSPOLICY_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/09/policy"; - - private static final QName POLICYSET = new QName(SCA_NS, "policySet"); - - private static final QName INTENTMAP = new QName(SCA_NS, "intentMap"); - - private static final QName QUALIFIER = new QName(SCA_NS, "qualifier"); - - private static final QName POLICYSETREFERENCE = new QName(SCA_NS, "policySetReference"); - - private static final QName WSPOLICYATTACHMENT = new QName(WSPOLICY_NAMESPACE, "PolicyAttachment"); - - @Constructor - public PolicySetLoader(@Reference LoaderRegistry registry) { - super(registry); - - } - - @Override - public QName getXMLType() { - return POLICYSET; - } - - public PolicySet load(ModelObject object, XMLStreamReader reader, - DeploymentContext deploymentContext) - throws XMLStreamException { - assert POLICYSET.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - String provides = reader.getAttributeValue(null, "provides"); - String appliesTo = reader.getAttributeValue(null, "appliesTo"); - PolicySet policySet = new PolicySet(new QName(SCA_NS, name), parseIntentName(provides)); - String[] appliesToArtifact = split(appliesTo); - for (String artifact : appliesToArtifact) { - policySet.addAppliedArtifacts(new QName(SCA_NS, artifact)); - } - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (INTENTMAP.equals(qname)) { - policySet.addIntentMap(loadIntentMap(reader, deploymentContext)); - } else if (POLICYSETREFERENCE.equals(qname)) { - policySet.addPolicySetReference(loadPolicyReference(reader, deploymentContext)); - } else if (WSPOLICYATTACHMENT.equals(qname)) { - policySet.addWsPolicyAttachment(loadWSPolicyAttachment(reader, deploymentContext)); - } - - reader.next(); - break; - case END_ELEMENT: - if (reader.getName().equals(POLICYSET)) { - return policySet; - } - break; - } - } - - } - - private PolicySetReference loadPolicyReference(XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException { - assert POLICYSETREFERENCE.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - LoaderUtil.skipToEndElement(reader); - return new PolicySetReference(new QName(SCA_NS, name)); - } - - private IntentMap loadIntentMap(XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException { - assert INTENTMAP.equals(reader.getName()); - String defaultIntentAttr = reader.getAttributeValue(null, "default"); - String provides = reader.getAttributeValue(null, "provides"); - IntentMap intentMap = new IntentMap(defaultIntentAttr, java.util.Arrays.asList(split(provides))); - //parentPolicySet.addIntentMap(intentMap); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (QUALIFIER.equals(qname)) { - intentMap.addQualifier(loadQualifier(reader, deploymentContext)); - } - reader.next(); - break; - case END_ELEMENT: - if (reader.getName().equals(INTENTMAP)) { - return intentMap; - } - } - } - - } - - private Qualifier loadQualifier(XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException { - assert QUALIFIER.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - Qualifier qualifier = new Qualifier(name); - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (INTENTMAP.equals(qname)) { - qualifier.setIntentMap(loadIntentMap(reader, deploymentContext)); - } else if (WSPOLICYATTACHMENT.equals(qname)) { - qualifier.addWsPolicyAttachment(loadWSPolicyAttachment(reader, deploymentContext)); - } - reader.next(); - break; - case END_ELEMENT: - if (reader.getName().equals(QUALIFIER)) { - return qualifier; - } - } - } - - } - - private WSPolicyAttachment loadWSPolicyAttachment(XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException { - return new WSPolicyAttachment(); - } - - /** - * Split a string to string array separated by " " - */ - private static String[] split(String string) { - if (string == null) { - return new String[0]; - } - String[] intents = string.split("[ ]+"); - return intents; - } - - private static List parseIntentName(String attributes) { - String[] intents = split(attributes); - List result = new ArrayList(intents.length); - for (String intent : intents) { - result.add(new IntentName(intent)); - } - return result; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java deleted file mode 100644 index ac39c135d9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.w3c.dom.Document; -import static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Property; - -/** - * Loads a property from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class PropertyLoader extends LoaderExtension { - public static final String PROPERTY_NAME_ATTR = "name"; - public static final String PROPERTY_TYPE_ATTR = "type"; - public static final String PROPERTY_MANY_ATTR = "many"; - public static final String REQUIRED_ATTR = "override"; - - public static final QName PROPERTY = new QName(SCA_NS, "property"); - private final DocumentBuilder documentBuilder; - - @Constructor - public PropertyLoader(@Reference LoaderRegistry registry) { - super(registry); - try { - documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } catch (ParserConfigurationException e) { - // we should be able to construct the default DocumentBuilder - throw new AssertionError(e); - } - } - - public QName getXMLType() { - return PROPERTY; - } - - public Property load(ModelObject object, XMLStreamReader reader, - DeploymentContext ctx) - throws XMLStreamException, LoaderException { - assert PROPERTY.equals(reader.getName()); - String name = reader.getAttributeValue(null, PROPERTY_NAME_ATTR); - String typeName = reader.getAttributeValue(null, PROPERTY_TYPE_ATTR); - QName xmlType = null; - if (typeName != null) { - int index = typeName.indexOf(':'); - if (index != -1) { - String prefix = typeName.substring(0, index); - String localName = typeName.substring(index + 1); - String ns = reader.getNamespaceURI(prefix); - xmlType = new QName(ns, localName, prefix); - } - } - boolean many = Boolean.parseBoolean(reader.getAttributeValue(null, PROPERTY_MANY_ATTR)); - String required = reader.getAttributeValue(null, REQUIRED_ATTR); - Document value = PropertyUtils.createPropertyValue(reader, xmlType, documentBuilder); - - Property property = new Property(); - property.setRequired(Boolean.parseBoolean(required)); - property.setName(name); - property.setXmlType(xmlType); - property.setMany(many); - - property.setDefaultValue(value); - return property; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyUtils.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyUtils.java deleted file mode 100644 index 57c1e1b5f4..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/PropertyUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * @version $Rev$ $Date$ - */ -public final class PropertyUtils { - - private PropertyUtils() { - } - - public static Document createPropertyValue(XMLStreamReader reader, QName type, DocumentBuilder builder) - throws XMLStreamException { - Document doc = builder.newDocument(); - - // root element has no namespace and local name "value" - Element root = doc.createElementNS(null, "value"); - if (type != null) { - Attr xsi = doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi"); - xsi.setValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); - root.setAttributeNodeNS(xsi); - - String prefix = type.getPrefix(); - if (prefix == null || prefix.length() == 0) { - prefix = "ns"; - } - Attr typeXmlns = doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:" + prefix); - typeXmlns.setValue(type.getNamespaceURI()); - root.setAttributeNodeNS(typeXmlns); - - Attr xsiType = doc.createAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type"); - xsiType.setValue(prefix + ":" + type.getLocalPart()); - root.setAttributeNodeNS(xsiType); - } - doc.appendChild(root); - - loadPropertyValue(reader, root); - return doc; - } - - /** - * Load a property value specification from an StAX stream into a DOM Document. Only elements, text and attributes - * are processed; all comments and other whitespace are ignored. - * - * @param reader the stream to read from - * @param root the DOM node to load - * @throws javax.xml.stream.XMLStreamException - * - */ - public static void loadPropertyValue(XMLStreamReader reader, Node root) throws XMLStreamException { - Document document = root.getOwnerDocument(); - Node current = root; - while (true) { - switch (reader.next()) { - case XMLStreamConstants.START_ELEMENT: - QName name = reader.getName(); - Element child = document.createElementNS(name.getNamespaceURI(), name.getLocalPart()); - - // add the attributes for this element - int count = reader.getAttributeCount(); - for (int i = 0; i < count; i++) { - String ns = reader.getAttributeNamespace(i); - String localPart = reader.getAttributeLocalName(i); - String value = reader.getAttributeValue(i); - child.setAttributeNS(ns, localPart, value); - } - - // push the new element and make it the current one - current.appendChild(child); - current = child; - break; - case XMLStreamConstants.CDATA: - current.appendChild(document.createCDATASection(reader.getText())); - break; - case XMLStreamConstants.CHARACTERS: - current.appendChild(document.createTextNode(reader.getText())); - break; - case XMLStreamConstants.END_ELEMENT: - // if we are back at the root then we are done - if (current == root) { - return; - } - - // pop the element off the stack - current = current.getParentNode(); - } - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java deleted file mode 100644 index 54183d1c72..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -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 static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.UnrecognizedElementException; -import org.apache.tuscany.spi.model.BindingDefinition; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Multiplicity; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * Loads a reference from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class ReferenceLoader extends LoaderExtension { - public static final QName REFERENCE = new QName(SCA_NS, "reference"); - private static final Map MULTIPLICITY = new HashMap(4); - - 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); - } - - @Constructor - public ReferenceLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return REFERENCE; - } - - public ReferenceDefinition load(ModelObject object, XMLStreamReader reader, DeploymentContext context) - throws XMLStreamException, LoaderException { - assert REFERENCE.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - String multiplicityVal = reader.getAttributeValue(null, "multiplicity"); - Multiplicity multiplicity = multiplicity(multiplicityVal, Multiplicity.ONE_ONE); - ReferenceDefinition referenceDefinition = new ReferenceDefinition(); - referenceDefinition.setMultiplicity(multiplicity); - referenceDefinition.setUri(context.getComponentId().resolve('#' + name)); - while (true) { - switch (reader.next()) { - case START_ELEMENT: - ModelObject o = registry.load(null, reader, context); - if (o instanceof ServiceContract) { - referenceDefinition.setServiceContract((ServiceContract) o); - } else if (o instanceof BindingDefinition) { - referenceDefinition.addBinding((BindingDefinition) o); - } else { - throw new UnrecognizedElementException(reader.getName()); - } - break; - case END_ELEMENT: - return referenceDefinition; - } - } - } - - /** - * Convert a "multiplicity" attribute to the equivalent enum value. - * - * @param multiplicity the attribute to convert - * @param def the default value - * @return the enum equivalent - */ - private static Multiplicity multiplicity(String multiplicity, Multiplicity def) { - return multiplicity == null ? def : MULTIPLICITY.get(multiplicity); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java deleted file mode 100644 index c5be797cda..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.net.URI; -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 static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.QualifiedName; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.UnrecognizedElementException; -import org.apache.tuscany.spi.model.BindingDefinition; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; - -/** - * Loads a service definition from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class ServiceLoader extends LoaderExtension { - private static final QName SERVICE = new QName(SCA_NS, "service"); - - @Constructor - public ServiceLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return SERVICE; - } - - public ServiceDefinition load(ModelObject object, XMLStreamReader reader, DeploymentContext context) - throws XMLStreamException, LoaderException { - assert SERVICE.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - URI compositeId = context.getComponentId(); - URI componentBase = URI.create(compositeId + "/"); - ServiceDefinition def = new ServiceDefinition(); - def.setUri(compositeId.resolve('#' + name)); - - URI targetUri = null; - String promote = reader.getAttributeValue(null, "promote"); - if (promote != null) { - QualifiedName qName = new QualifiedName(promote); - targetUri = componentBase.resolve(qName.getFragment()); - } - while (true) { - int i = reader.next(); - switch (i) { - case START_ELEMENT: - ModelObject o = registry.load(null, reader, context); - if (o instanceof ServiceContract) { - def.setServiceContract((ServiceContract) o); - } else if (o instanceof BindingDefinition) { - def.addBinding((BindingDefinition) o); - } else { - throw new UnrecognizedElementException(reader.getName()); - } - break; - case END_ELEMENT: - if (SERVICE.equals(reader.getName())) { - if (targetUri != null) { - def.setTarget(targetUri); - } - return def; - } - break; - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java deleted file mode 100644 index eda09d6f11..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -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 javax.xml.stream.XMLStreamException; - -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.PropertyObjectFactory; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.PropertyValue; - -import org.apache.tuscany.core.injection.SingletonObjectFactory; - -/** - * Implementation of StAXPropertyFactory that interprets the XML as - * - * @version $Rev$ $Date$ - */ -public class StringParserPropertyFactory implements PropertyObjectFactory { - - public ObjectFactory createObjectFactory(Property property, PropertyValue value) - throws LoaderException { - String text = value.getValue().getDocumentElement().getTextContent(); - return new SingletonObjectFactory(createInstance(text, property.getJavaType())); - } - - @SuppressWarnings("unchecked") - public T createInstance(String text, Class type) throws LoaderException { - // Class type = property.getJavaType(); - assert type != null : "property type is null"; - - // degenerate case where property type is a String - if (String.class.equals(type)) { - return type.cast(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 type.cast(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 type.cast(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 LoaderException(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 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 LoaderException("Property type cannot be instantiated: " + type.getName()); - } catch (InvocationTargetException e) { - // FIXME we should throw something better - throw new LoaderException(e.getCause()); - } - - // do we have a property editor for it? - PropertyEditor editor = PropertyEditorManager.findEditor(type); - if (editor != null) { - try { - editor.setAsText(text); - return (T) editor.getValue(); - } catch (IllegalArgumentException e) { - // FIXME we should throw something better - throw new LoaderException(e); - - } - } - - // FIXME we should throw something better - throw new LoaderException("Do not have a way to parse a String into a " + type.getName()); - - } - - @SuppressWarnings("unchecked") - public ObjectFactory createObjectFactory(String text, Property property) - throws XMLStreamException, LoaderException { - Class type = property.getJavaType(); - assert type != null : "property type is null"; - - // degenerate case where property type is a String - if (String.class.equals(type)) { - return new SingletonObjectFactory(type.cast(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(type.cast(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(type.cast(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 LoaderException(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 LoaderException("Property type cannot be instantiated: " + type.getName()); - } catch (InvocationTargetException e) { - // FIXME we should throw something better - throw new LoaderException(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((T) editor.getValue()); - } catch (IllegalArgumentException e) { - // FIXME we should throw something better - throw new LoaderException(e); - - } - } - - // FIXME we should throw something better - throw new LoaderException("Do not have a way to parse a String into a " + type.getName()); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/WireLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/WireLoader.java deleted file mode 100644 index 9c60790111..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/loader/WireLoader.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.net.URI; -import java.net.URISyntaxException; -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 static org.osoa.sca.Constants.SCA_NS; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.QualifiedName; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.InvalidWireException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.WireDefinition; - -/** - * Loads a wire from an XML-based assembly file - * - * @version $Rev: 465084 $ $Date: 2006-10-18 04:00:49 +0530 (Wed, 18 Oct 2006) $ - */ -public class WireLoader extends LoaderExtension { - private static final QName WIRE = new QName(SCA_NS, "wire"); - private static final QName SOURCE_URI = new QName(SCA_NS, "source.uri"); - private static final QName TARGET_URI = new QName(SCA_NS, "target.uri"); - - @Constructor - public WireLoader(@Reference LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return WIRE; - } - - public WireDefinition load( - ModelObject object, - XMLStreamReader reader, - DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - assert WIRE.equals(reader.getName()); - WireDefinition wireDefn; - URI sourceURI = null; - URI targetURI = null; - String uriString; - while (true) { - switch (reader.next()) { - case START_ELEMENT: - try { - if (reader.getName().equals(SOURCE_URI)) { - uriString = reader.getElementText(); - if (uriString != null && uriString.trim().length() > 0) { - QualifiedName name = new QualifiedName(uriString); - if (name.getPortName() == null) { - sourceURI = new URI(uriString); - } else { - sourceURI = new URI(name.getPartName() + "#" + name.getPortName()); - } - } else { - throw new InvalidWireException("Wire source not defined"); - } - } else if (reader.getName().equals(TARGET_URI)) { - uriString = reader.getElementText(); - if (uriString != null && uriString.trim().length() > 0) { - QualifiedName name = new QualifiedName(uriString); - if (name.getPortName() == null) { - targetURI = new URI(uriString); - } else { - targetURI = new URI(name.getPartName() + "#" + name.getPortName()); - } - } else { - throw new InvalidWireException("Wire target not defined"); - } - } else { - QName name = reader.getName(); - throw new InvalidWireException("Unrecognized element in wire ", name.toString()); - } - } catch (URISyntaxException e) { - throw new InvalidWireException("Invalid wire uri", e); - } - - reader.next(); - break; - case END_ELEMENT: - if (reader.getName().equals(WIRE)) { - if (sourceURI != null && targetURI != null) { - wireDefn = new WireDefinition(); - wireDefn.setSource(sourceURI); - wireDefn.setTarget(targetURI); - } else { - throw new InvalidWireException("Incomplete wire definition"); - } - return wireDefn; - } - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java deleted file mode 100644 index 14468061e3..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import java.io.PrintWriter; - -import org.apache.tuscany.api.TuscanyException; -import org.apache.tuscany.api.TuscanyRuntimeException; -import org.apache.tuscany.host.monitor.ExceptionFormatter; - -/** - * Performs basics formatting of exceptions for JDK logging - * - * @version $Rev$ $Date$ - */ -public class DefaultExceptionFormatter implements ExceptionFormatter { - - public DefaultExceptionFormatter() { - } - - public boolean canFormat(Class type) { - return Throwable.class.isAssignableFrom(type); - } - - public PrintWriter write(PrintWriter writer, Throwable exception) { - if (exception instanceof TuscanyException) { - TuscanyException e = (TuscanyException) exception; - e.appendBaseMessage(writer); - } else if (exception instanceof TuscanyRuntimeException) { - TuscanyRuntimeException e = (TuscanyRuntimeException) exception; - e.appendBaseMessage(writer); - } - writer.append("\n"); - return writer; - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java deleted file mode 100644 index cf07b0f914..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -/** - * 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/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java deleted file mode 100644 index 4adff1b0db..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.LogRecord; -import java.util.logging.Logger; - -import org.osoa.sca.annotations.Service; - -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.host.monitor.FormatterRegistry; - -/** - * 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 - */ -@Service(interfaces = {MonitorFactory.class, FormatterRegistry.class}) -public class JavaLoggingMonitorFactory extends ProxyMonitorFactory { - - /** - * 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, may be null or empty. - * @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) { - Map configProperties = new HashMap(); - configProperties.put("levels", levels); - configProperties.put("defaultLevel", defaultLevel); - configProperties.put("bundleName", bundleName); - initInternal(configProperties); - } - - /** - * Constructs a MonitorFactory that needs to be subsequently configured via a call to {@link #initialize}. - */ - public JavaLoggingMonitorFactory() { - } - - protected InvocationHandler createInvocationHandler(Class monitorInterface, - Map levels) { - ResourceBundle bundle = locateBundle(monitorInterface, bundleName); - Logger logger = Logger.getLogger(monitorInterface.getName()); - return new LoggingHandler(logger, levels, bundle); - } - - private 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.setMessage(formatException((Throwable) o)); - break; - } - } - } - logRecord.setResourceBundle(bundle); - logger.log(logRecord); - } - return null; - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java deleted file mode 100644 index 92224d469f..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import org.apache.tuscany.host.MonitorFactory; - -import java.util.Map; - -/** - * Helper for creating MonitorFactory instances. - * - * @version $$Rev$$ $$Date$$ - */ - -public final class MonitorFactoryUtil { - /** - * Hide the constructor - */ - private MonitorFactoryUtil() { - } - - /** - * Creates a MonitorFactory instance of the specified type. - * @param name fully qualified classname of the desired MonitorFactory type - * @param props collection of initialization properties - * @return a configured MonitorFactory instance, or null if the factory could not be instantiated. - */ - @SuppressWarnings("unchecked") - public static MonitorFactory createMonitorFactory(String name, Map props) { - Class clazz; - try { - clazz = (Class) Class.forName(name); - } catch (ClassNotFoundException cnfe) { - return null; - } catch (ClassCastException cce) { - return null; - } - - return createMonitorFactory(clazz, props); - } - - /** - * Creates a MonitorFactory instance of the specified type. - * @param mfc class of the desired MonitorFactory type - * @param props collection of initialization properties - * @return a configured MonitorFactory instance, or null if the factory could not be instantiated. - */ - public static MonitorFactory createMonitorFactory(Class mfc, Map props) { - MonitorFactory mf; - try { - mf = mfc.newInstance(); - mf.initialize(props); - } catch (InstantiationException e) { - throw new AssertionError(e); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - // allow IllegalArgumentException to propogate out - - return mf; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java deleted file mode 100644 index 46c52e38f6..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Map; - -import org.osoa.sca.annotations.EagerInit; - -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.host.monitor.ExceptionFormatter; - -/** - * Implementation of a {@link MonitorFactory} that produces implementations that simply return. - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class NullMonitorFactory implements MonitorFactory { - - /** - * Singleton hander that does nothing. - */ - private static final InvocationHandler NULL_MONITOR = new InvocationHandler() { - public Object invoke(Object proxy, Method method, Object[] args) { - return null; - } - }; - - public void initialize(Map configProperties) { - } - - 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)); - } - - public void register(ExceptionFormatter formatter) { - - } - - public void unregister(ExceptionFormatter formatter) { - - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/ProxyMonitorFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/ProxyMonitorFactory.java deleted file mode 100644 index d9ca9e6cfc..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/monitor/ProxyMonitorFactory.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import java.util.Map; -import java.util.Properties; -import java.util.HashMap; -import java.util.ResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.List; -import java.util.ArrayList; -import java.util.WeakHashMap; -import java.util.logging.Level; -import java.lang.ref.WeakReference; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.host.monitor.FormatterRegistry; -import org.apache.tuscany.host.monitor.ExceptionFormatter; -import org.apache.tuscany.api.annotation.LogLevel; - -/** - * @version $Rev$ $Date$ - */ -public abstract class ProxyMonitorFactory implements MonitorFactory, FormatterRegistry { - protected String bundleName; - protected final List formatters = new ArrayList(); - protected final ExceptionFormatter defaultFormatter = new DefaultExceptionFormatter(); - protected Level defaultLevel; - protected Map levels; - private final Map, WeakReference> proxies = new WeakHashMap, WeakReference>(); - - public void initialize(Map configProperties) { - if (configProperties == null) { - return; - } - initInternal(configProperties); - } - - protected void initInternal(Map configProperties) { - try { - this.defaultLevel = (Level) configProperties.get("defaultLevel"); - this.bundleName = (String) configProperties.get("bundleName"); - Properties levels = (Properties) configProperties.get("levels"); - - this.levels = new HashMap(); - if (levels != null) { - 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); - } - } - } - } catch (ClassCastException cce) { - throw new IllegalArgumentException(cce.getLocalizedMessage()); - } - } - - public synchronized T getMonitor(Class monitorInterface) { - T proxy = getCachedMonitor(monitorInterface); - if (proxy == null) { - proxy = createMonitor(monitorInterface); - proxies.put(monitorInterface, new WeakReference(proxy)); - } - return proxy; - } - - protected T getCachedMonitor(Class monitorInterface) { - WeakReference ref = proxies.get(monitorInterface); - return (ref != null) ? monitorInterface.cast(ref.get()) : null; - } - - protected T createMonitor(Class monitorInterface) { - String className = monitorInterface.getName(); - Method[] methods = monitorInterface.getMethods(); - Map levels = new HashMap(methods.length); - for (Method method : methods) { - String key = className + '#' + method.getName(); - Level level = null; - if (this.levels != null) { - 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); - } - - InvocationHandler handler = createInvocationHandler(monitorInterface, levels); - Object proxy = Proxy.newProxyInstance(monitorInterface.getClassLoader(), - new Class[]{monitorInterface}, - handler); - return monitorInterface.cast(proxy); - } - - protected 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) { - //ok - } - 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; - } - } - - public void register(ExceptionFormatter formatter) { - formatters.add(formatter); - } - - public void unregister(ExceptionFormatter formatter) { - formatters.remove(formatter); - } - - protected abstract InvocationHandler createInvocationHandler(Class monitorInterface, - Map levels); - - protected String formatException(Throwable e) { - ExceptionFormatter formatter = defaultFormatter; - for (ExceptionFormatter candidate : formatters) { - if (candidate.canFormat(e.getClass())) { - formatter = candidate; - break; - } - } - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - format(pw, e); - pw.close(); - return writer.toString(); - } - - protected void format(PrintWriter writer, Throwable throwable) { - writer.println(throwable.getClass().getName()); - StackTraceElement[] trace = throwable.getStackTrace(); - for (StackTraceElement aTrace : trace) { - writer.println("\tat " + aTrace); - } - Throwable ourCause = throwable.getCause(); - - if (ourCause != null) { - printStackTraceAsCause(writer, ourCause, trace); - } - } - - protected void printStackTraceAsCause(PrintWriter pw, - Throwable throwable, - StackTraceElement[] causedTrace) { - - // Compute number of frames in common between this and caused - StackTraceElement[] trace = throwable.getStackTrace(); - int m = trace.length - 1; - int n = causedTrace.length - 1; - while (m >= 0 && n >= 0 && trace[m].equals(causedTrace[n])) { - m--; - n--; - } - int framesInCommon = trace.length - 1 - m; - - pw.println("Caused by: " + throwable.getClass().getName()); - - ExceptionFormatter formatter = defaultFormatter; - for (ExceptionFormatter candidate : formatters) { - if (candidate.canFormat(throwable.getClass())) { - formatter = candidate; - break; - } - } - formatter.write(pw, throwable); - - for (int i = 0; i <= m; i++) { - pw.println("\tat " + trace[i]); - } - if (framesInCommon != 0) { - pw.println("\t... " + framesInCommon + " more"); - } - - // Recurse if we have a cause - Throwable ourCause = throwable.getCause(); - if (ourCause != null) { - printStackTraceAsCause(pw, ourCause, trace); - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireResolver.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireResolver.java deleted file mode 100644 index 8502f8d5f8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireResolver.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.resolver; - -import java.net.URI; - -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * Implementations are responsible for resolving autowire targets in an SCA Domain. It is assumed that autowire - * resolution occurs after resource resolution as service interface classes may be laoded - * - * @version $Rev$ $Date$ - */ -public interface AutowireResolver { - - /** - * Resolves autowires for a component definition and its decendents - * - * @param parentDefinition the parent - * @param definition the component definition to resolve autowires for - * @throws ResolutionException - */ - void resolve(ComponentDefinition>> parentDefinition, - ComponentDefinition> definition) throws ResolutionException; - - /** - * Resolves autowires for a composite component type and its decendents - * - * @param compositeType the component type to resolve autowires for - * @throws ResolutionException - */ - @SuppressWarnings({"unchecked"}) - public void resolve(CompositeComponentType compositeType) throws ResolutionException; - - /** - * Adds the uri of a host system service that can be an autowire target - * - * @param contract the service contract of the system service - * @param uri the component uri - */ - void addHostUri(ServiceContract contract, URI uri); - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireTargetNotFoundException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireTargetNotFoundException.java deleted file mode 100644 index 1526724ca9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/AutowireTargetNotFoundException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.resolver; - -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * @version $Rev$ $Date$ - */ -public class AutowireTargetNotFoundException extends ResolutionException { - public AutowireTargetNotFoundException(String message, String identifier) { - super(message, identifier); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/DefaultAutowireResolver.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/DefaultAutowireResolver.java deleted file mode 100644 index eab78e25d9..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/resolver/DefaultAutowireResolver.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.resolver; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * Default implementation of an autowire resolver - * - * @version $Rev$ $Date$ - */ -public class DefaultAutowireResolver implements AutowireResolver { - private Map hostAutowire = new HashMap(); - - - @SuppressWarnings({"unchecked"}) - public void resolve(ComponentDefinition>> parentDefinition, - ComponentDefinition> definition) - throws ResolutionException { - ComponentType type = definition.getImplementation().getComponentType(); - // resolve autowires - if (type instanceof CompositeComponentType) { - CompositeComponentType compositeType = (CompositeComponentType) type; - for (ComponentDefinition> child : compositeType.getComponents().values()) { - Implementation implementation = child.getImplementation(); - ComponentType childType = implementation.getComponentType(); - if (childType instanceof CompositeComponentType) { - // recurse decendents for composites - resolve((ComponentDefinition>>) definition, child); - } - Map targets = child.getReferenceTargets(); - for (ReferenceDefinition reference : childType.getReferences().values()) { - ReferenceTarget target = targets.get(reference.getUri().getFragment()); - if (target == null) { - continue; - } - if (target.isAutowire()) { - ServiceContract requiredContract = reference.getServiceContract(); - resolve(compositeType, requiredContract, target, reference.isRequired()); - } - } - } - } else { - // a leaf level component - ComponentType componentType = definition.getImplementation().getComponentType(); - Map targets = definition.getReferenceTargets(); - for (ReferenceDefinition reference : componentType.getReferences().values()) { - ReferenceTarget target = targets.get(reference.getUri().getFragment()); - if (target == null) { - continue; - } - if (target.isAutowire()) { - ServiceContract requiredContract = reference.getServiceContract(); - CompositeComponentType ctype = parentDefinition.getImplementation().getComponentType(); - resolve(ctype, requiredContract, target, reference.isRequired()); - } - } - } - } - - public void addHostUri(ServiceContract contract, URI uri) { - hostAutowire.put(contract, uri); - } - - public void resolve(CompositeComponentType compositeType) throws ResolutionException { - for (ComponentDefinition> child : compositeType.getComponents().values()) { - Implementation implementation = child.getImplementation(); - ComponentType childType = implementation.getComponentType(); - if (childType instanceof CompositeComponentType) { - // recurse decendents for composites - resolve(null, child); - } - Map targets = child.getReferenceTargets(); - for (ReferenceDefinition reference : childType.getReferences().values()) { - ReferenceTarget target = targets.get(reference.getUri().getFragment()); - if (target == null) { - continue; - } - if (target.isAutowire()) { - ServiceContract requiredContract = reference.getServiceContract(); - resolve(compositeType, requiredContract, target, reference.isRequired()); - } - } - } - } - /** - * Performs the actual resolution against a composite TODO this should be extensible allowing for path - * optimizations - * - * @param compositeType the composite component type to resolve against - * @param requiredContract the required target contract - * @param target the reference target - * @param required true if the autowire is required - * @throws AutowireTargetNotFoundException - * - */ - private void resolve(CompositeComponentType compositeType, - ServiceContract requiredContract, - ReferenceTarget target, - boolean required) throws AutowireTargetNotFoundException { - // for now, attempt to match on interface, assume the class can be loaded - Class requiredInterface = requiredContract.getInterfaceClass(); - if (requiredInterface == null) { - throw new UnsupportedOperationException("Only interfaces support for autowire"); - } - // autowire to a target in the parent - URI targetUri = null; - URI candidateUri = null; - // find a suitable target, starting with components first - for (ComponentDefinition> candidate : compositeType.getComponents().values()) { - Implementation candidateImpl = candidate.getImplementation(); - ComponentType candidateType = candidateImpl.getComponentType(); - for (ServiceDefinition service : candidateType.getServices().values()) { - Class serviceInterface = service.getServiceContract().getInterfaceClass(); - if (serviceInterface == null) { - continue; - } - if (requiredInterface.equals(serviceInterface)) { - targetUri = URI.create(candidate.getUri().toString() + service.getUri()); - break; - } else if (candidateUri == null && requiredInterface.isAssignableFrom(serviceInterface)) { - candidateUri = URI.create(candidate.getUri().toString() + service.getUri()); - } - } - if (targetUri != null) { - break; - } - } - if (targetUri == null) { - targetUri = resolvePrimordial(requiredContract); - } - if (candidateUri != null) { - targetUri = candidateUri; - } - if (targetUri != null) { - target.addTarget(targetUri); - } - if (targetUri == null && required) { - String uri = target.getReferenceName().toString(); - throw new AutowireTargetNotFoundException("No suitable target found for", uri); - } - } - - private URI resolvePrimordial(ServiceContract contract) { - Class requiredClass = contract.getInterfaceClass(); - for (Map.Entry entry : hostAutowire.entrySet()) { - if (requiredClass.isAssignableFrom(entry.getKey().getInterfaceClass())) { - return entry.getValue(); - } - } - return null; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java deleted file mode 100644 index 4a9cbb1ff5..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.runtime; - -import static org.apache.tuscany.spi.bootstrap.ComponentNames.TUSCANY_DEPLOYER; -import static org.apache.tuscany.spi.bootstrap.ComponentNames.TUSCANY_SYSTEM; -import static org.apache.tuscany.spi.bootstrap.ComponentNames.TUSCANY_SYSTEM_ROOT; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.core.bootstrap.Bootstrapper; -import org.apache.tuscany.core.bootstrap.DefaultBootstrapper; -import org.apache.tuscany.core.bootstrap.ExtensionActivator; -import org.apache.tuscany.core.builder.ConnectorImpl; -import org.apache.tuscany.core.component.ComponentManagerImpl; -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.core.component.scope.CompositeScopeContainer; -import org.apache.tuscany.core.component.scope.ScopeRegistryImpl; -import org.apache.tuscany.core.deployer.DeployerImpl; -import org.apache.tuscany.core.monitor.NullMonitorFactory; -import org.apache.tuscany.core.resolver.AutowireResolver; -import org.apache.tuscany.core.resolver.DefaultAutowireResolver; -import org.apache.tuscany.core.services.classloading.ClassLoaderRegistryImpl; -import org.apache.tuscany.core.util.IOHelper; -import org.apache.tuscany.host.MonitorFactory; -import org.apache.tuscany.host.RuntimeInfo; -import org.apache.tuscany.host.management.ManagementService; -import org.apache.tuscany.host.monitor.FormatterRegistry; -import org.apache.tuscany.host.runtime.InitializationException; -import org.apache.tuscany.host.runtime.TuscanyRuntime; -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.deployer.Deployer; -import org.apache.tuscany.spi.idl.java.JavaServiceContract; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.services.classloading.ClassLoaderRegistry; -import org.apache.tuscany.spi.services.management.TuscanyManagementService; -import org.osoa.sca.ComponentContext; - -/** - * @version $Rev$ $Date$ - */ -public abstract class AbstractRuntime implements TuscanyRuntime { - private static final URI MONITOR_URI = TUSCANY_SYSTEM_ROOT.resolve("MonitorFactory"); - - private static final URI COMPONENT_MGR_URI = TUSCANY_SYSTEM_ROOT.resolve("ComponentManager"); - - private static final URI AUTOWIRE_RESOLVER_URI = TUSCANY_SYSTEM_ROOT.resolve("AutowireResolver"); - - private static final URI SCOPE_REGISTRY_URI = TUSCANY_SYSTEM_ROOT.resolve("ScopeRegistry"); - - private static final URI WORK_CONTEXT_URI = TUSCANY_SYSTEM.resolve("WorkContext"); - - private static final URI RUNTIME_INFO_URI = TUSCANY_SYSTEM_ROOT.resolve("RuntimeInfo"); - - private static final URI CLASSLOADER_REGISTRY_URI = TUSCANY_SYSTEM_ROOT.resolve("ClassLoaderRegistry"); - - private static final URI HOST_CLASSLOADER_ID = URI.create("sca://./hostClassLoader"); - - private static final URI BOOT_CLASSLOADER_ID = URI.create("sca://./bootClassLoader"); - - protected final XMLInputFactory xmlFactory; - protected URL systemScdl; - protected String applicationName; - protected URL applicationScdl; - protected Class runtimeInfoType; - protected ManagementService managementService; - - // primorial components automatically registered with the runtime - /** - * Information provided by the host about its runtime environment. - */ - protected I runtimeInfo; - - /** - * MonitorFactory provided by the host for directing events to its - * management framework. - */ - protected MonitorFactory monitorFactory; - - /** - * The ComponentManager that manages all components in this runtime. - */ - protected ComponentManager componentManager; - - /** - * Registry for ClassLoaders used by this runtime. - */ - protected ClassLoaderRegistry classLoaderRegistry; - - protected AutowireResolver resolver; - - protected Component systemComponent; - protected Component tuscanySystem; - - protected ScopeRegistry scopeRegistry; - protected Collection activators; - - protected AbstractRuntime(Class runtimeInfoType) { - this(runtimeInfoType, new NullMonitorFactory()); - } - - protected AbstractRuntime(Class runtimeInfoType, MonitorFactory monitorFactory) { - this.runtimeInfoType = runtimeInfoType; - this.monitorFactory = monitorFactory; - xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader()); - classLoaderRegistry = new ClassLoaderRegistryImpl(); - classLoaderRegistry.register(BOOT_CLASSLOADER_ID, getClass().getClassLoader()); - } - - public URL getSystemScdl() { - return systemScdl; - } - - public void setSystemScdl(URL systemScdl) { - this.systemScdl = systemScdl; - } - - public String getApplicationName() { - return applicationName; - } - - public void setApplicationName(String applicationName) { - this.applicationName = applicationName; - } - - public URL getApplicationScdl() { - return applicationScdl; - } - - public void setApplicationScdl(URL applicationScdl) { - this.applicationScdl = applicationScdl; - } - - public ClassLoader getHostClassLoader() { - return classLoaderRegistry.getClassLoader(HOST_CLASSLOADER_ID); - } - - public void setHostClassLoader(ClassLoader hostClassLoader) { - classLoaderRegistry.register(HOST_CLASSLOADER_ID, hostClassLoader); - } - - public I getRuntimeInfo() { - return runtimeInfo; - } - - public void setRuntimeInfo(I runtimeInfo) { - this.runtimeInfo = runtimeInfo; - } - - public MonitorFactory getMonitorFactory() { - return monitorFactory; - } - - public void setMonitorFactory(MonitorFactory monitorFactory) { - this.monitorFactory = monitorFactory; - } - - public ManagementService getManagementService() { - return managementService; - } - - public void setManagementService(ManagementService managementService) { - this.managementService = managementService; - } - - public void initialize() throws InitializationException { - // URI name = TUSCANY_SYSTEM_ROOT.resolve("main"); - Bootstrapper bootstrapper = createBootstrapper(); - Deployer deployer = bootstrapper.createDeployer(); - registerSystemComponent(TUSCANY_DEPLOYER, Deployer.class, deployer); - registerSystemComponent(WORK_CONTEXT_URI, WorkContext.class, new SimpleWorkContext()); - - this.scopeRegistry = bootstrapper.getScopeRegistry(); - - LoaderRegistry loaderRegistry = (LoaderRegistry)((DeployerImpl)deployer).getLoader(); - BuilderRegistry builderRegistry = (BuilderRegistry)((DeployerImpl)deployer).getBuilder(); - activators = getInstances(getHostClassLoader(), ExtensionActivator.class); - for (ExtensionActivator activator : activators) { - activator.start(loaderRegistry, builderRegistry); - } - - registerBaselineSystemComponents(); - } - - public void destroy() { - if (tuscanySystem != null) { - tuscanySystem.stop(); - tuscanySystem = null; - } - if (systemComponent != null) { - systemComponent.stop(); - systemComponent = null; - } - } - - public ComponentContext getComponentContext(URI componentId) { - Component component = componentManager.getComponent(componentId); - if (component == null) { - return null; - } - return component.getComponentContext(); - } - - protected Bootstrapper createBootstrapper() { - TuscanyManagementService tms = (TuscanyManagementService)getManagementService(); - resolver = new DefaultAutowireResolver(); - componentManager = new ComponentManagerImpl(tms, resolver); - Connector connector = new ConnectorImpl(componentManager); - return new DefaultBootstrapper(getMonitorFactory(), xmlFactory, componentManager, resolver, connector); - } - - protected void registerBaselineSystemComponents() throws InitializationException { - // register the RuntimeInfo provided by the host - registerSystemComponent(RUNTIME_INFO_URI, runtimeInfoType, runtimeInfo); - - // register the MonitorFactory provided by the host - List> monitorServices = new ArrayList>(); - monitorServices.add(MonitorFactory.class); - monitorServices.add(FormatterRegistry.class); - registerSystemComponent(MONITOR_URI, monitorServices, getMonitorFactory()); - - // register the ClassLoaderRegistry - registerSystemComponent(CLASSLOADER_REGISTRY_URI, ClassLoaderRegistry.class, classLoaderRegistry); - - // register the ComponentManager to that the fabric can wire to it - registerSystemComponent(COMPONENT_MGR_URI, ComponentManager.class, componentManager); - - // register the AutowireResolver - registerSystemComponent(AUTOWIRE_RESOLVER_URI, AutowireResolver.class, resolver); - - // register the ScopeRegistry - registerSystemComponent(SCOPE_REGISTRY_URI, ScopeRegistry.class, scopeRegistry); - } - - protected void registerSystemComponent(URI uri, Class type, I component) - throws InitializationException { - try { - JavaServiceContract contract = new JavaServiceContract(type); - componentManager.registerJavaObject(uri, contract, component); - } catch (RegistrationException e) { - throw new InitializationException(e); - } - } - - protected void registerSystemComponent(URI uri, List> types, I component) - throws InitializationException { - try { - List> contracts = new ArrayList>(); - for (Class type : types) { - contracts.add(new JavaServiceContract(type)); - - } - componentManager.registerJavaObject(uri, contracts, component); - } catch (RegistrationException e) { - throw new InitializationException(e); - } - } - - protected ComponentManager getComponentManager() { - return componentManager; - } - - protected ScopeRegistry getScopeRegistry() { - return scopeRegistry; - } - - protected WorkContext getWorkContext() { - try { - AtomicComponent component = (AtomicComponent)getComponentManager().getComponent(WORK_CONTEXT_URI); - return (WorkContext)component.getTargetInstance(); - } catch (TargetResolutionException e) { - throw new AssertionError(e); - } - } - - protected Deployer getDeployer() { - try { - AtomicComponent component = (AtomicComponent)getComponentManager().getComponent(TUSCANY_DEPLOYER); - return (Deployer)component.getTargetInstance(); - } catch (TargetResolutionException e) { - throw new AssertionError(e); - } - } - - /** - * Read the service name from a configuration file - * - * @param classLoader - * @param name The name of the service class - * @return A class name which extends/implements the service class - * @throws IOException - */ - private static Set getServiceNames(ClassLoader classLoader, String name) throws IOException { - Set set = new HashSet(); - Enumeration urls = classLoader.getResources("META-INF/services/" + name); - while (urls.hasMoreElements()) { - URL url = urls.nextElement(); - String service = getServiceName(url); - if (service != null) { - set.add(service); - - } - } - return set; - } - - private static String getServiceName(URL url) throws IOException { - InputStream is = IOHelper.getInputStream(url); - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(is)); - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } else if (!line.startsWith("#")) { - return line.trim(); - } - } - } finally { - if (reader != null) { - reader.close(); - } - } - return null; - } - - private static Collection getInstances(final ClassLoader classLoader, Class serviceClass) { - List instances = new ArrayList(); - try { - Set services = getServiceNames(classLoader, serviceClass.getName()); - for (String className : services) { - Class cls = Class.forName(className, true, classLoader); - instances.add(serviceClass.cast(cls.newInstance())); // NOPMD - } - } catch (Exception e) { - throw new IllegalStateException(e); - } - return instances; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/classloading/ClassLoaderRegistryImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/classloading/ClassLoaderRegistryImpl.java deleted file mode 100644 index afa7f64246..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/classloading/ClassLoaderRegistryImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.services.classloading; - -import java.net.URI; -import java.util.concurrent.ConcurrentHashMap; -import java.util.Map; - -import org.apache.tuscany.spi.services.classloading.ClassLoaderRegistry; -import org.apache.tuscany.spi.services.classloading.DuplicateClassLoaderException; - -/** - * Implementation of a registry for classloaders. - * - * @version $Rev$ $Date$ - */ -public class ClassLoaderRegistryImpl implements ClassLoaderRegistry { - private final Map registry = new ConcurrentHashMap(); - - public synchronized void register(URI id, ClassLoader classLoader) throws DuplicateClassLoaderException { - if (registry.containsKey(id)) { - throw new DuplicateClassLoaderException("Duplicate class loader", id.toString()); - } - registry.put(id, classLoader); - } - - public ClassLoader getClassLoader(URI id) { - return registry.get(id); - } - - public ClassLoader unregister(URI id) { - return registry.remove(id); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java deleted file mode 100644 index a48cd5a2d7..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.services.store.memory; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Service; - -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.event.AbstractEventPublisher; -import org.apache.tuscany.spi.services.store.DuplicateRecordException; -import org.apache.tuscany.spi.services.store.RecoveryListener; -import org.apache.tuscany.spi.services.store.Store; -import org.apache.tuscany.spi.services.store.StoreExpirationEvent; -import org.apache.tuscany.spi.services.store.StoreMonitor; -import org.apache.tuscany.spi.services.store.StoreWriteException; - -import org.apache.tuscany.api.annotation.Monitor; - -/** - * Implements a non-durable, non-transactional store using a simple in-memory map - * - * @version $Rev$ $Date$ - */ -@Service(Store.class) -@EagerInit -public class MemoryStore extends AbstractEventPublisher implements Store { - private Map> store; - // TODO integrate with a core threading scheme - private ScheduledExecutorService scheduler; - private long reaperInterval = 300000; - private StoreMonitor monitor; - private long defaultExpirationOffset = 600000; // 10 minutes - - public MemoryStore(@Monitor StoreMonitor monitor) { - this.monitor = monitor; - this.store = new ConcurrentHashMap>(); - this.scheduler = Executors.newSingleThreadScheduledExecutor(); - } - - /** - * Returns the maximum default expiration offset for records in the store - * - * @return the maximum default expiration offset for records in the store - */ - public long getDefaultExpirationOffset() { - return defaultExpirationOffset; - } - - /** - * Sets the maximum default expiration offset for records in the store - */ - @Property - public void setDefaultExpirationOffset(long defaultExpirationOffset) { - this.defaultExpirationOffset = defaultExpirationOffset; - } - - /** - * Sets the interval for expired entry scanning to be performed - */ - @Property - public void setReaperInterval(long reaperInterval) { - this.reaperInterval = reaperInterval; - } - - public long getReaperInterval() { - return reaperInterval; - } - - @Init - public void init() { - scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS); - monitor.start("In-memory store started"); - } - - @Destroy - public void destroy() { - scheduler.shutdown(); - monitor.stop("In-memory store stopped"); - } - - public void insertRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException { - Map map = store.get(owner); - if (map == null) { - map = new ConcurrentHashMap(); - store.put(owner, map); - } - if (map.containsKey(id)) { - throw new DuplicateRecordException(owner.getUri().toString(), id); - } - map.put(id, new Record(object, expiration)); - } - - public void updateRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException { - Map map = store.get(owner); - if (map == null) { - throw new StoreWriteException("Record not found", owner.getUri().toString(), id); - } - Record record = map.get(id); - if (record == null) { - throw new StoreWriteException("Record not found", owner.getUri().toString(), id); - } - record.data = object; - } - - public Object readRecord(SCAObject owner, String id) { - Map map = store.get(owner); - if (map == null) { - return null; - } - Record record = map.get(id); - if (record != null) { - return record.data; - } - return null; - } - - public void removeRecords() { - store.clear(); - } - - public void removeRecord(SCAObject owner, String id) throws StoreWriteException { - Map map = store.get(owner); - if (map == null) { - throw new StoreWriteException("Owner not found", owner.getUri().toString(), id); - } - if (map.remove(id) == null) { - throw new StoreWriteException("Owner not found", owner.getUri().toString(), id); - } - } - - public void recover(RecoveryListener listener) { - throw new UnsupportedOperationException(); - } - - private class Record { - private Object data; - private long expiration = NEVER; - - public Record(Object data, long expiration) { - this.data = data; - this.expiration = expiration; - } - - public Object getData() { - return data; - } - - public long getExpiration() { - return expiration; - } - } - - private class Reaper implements Runnable { - - public void run() { - long now = System.currentTimeMillis(); - for (Map.Entry> entries : store.entrySet()) { - for (Map.Entry entry : entries.getValue().entrySet()) { - final long expiration = entry.getValue().expiration; - if (expiration != NEVER && now >= expiration) { - SCAObject owner = entries.getKey(); - Object instance = entry.getValue().getData(); - // notify listeners of the expiration - StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance); - publish(event); - entries.getValue().remove(entry.getKey()); - } - } - } - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/FileHelper.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/FileHelper.java deleted file mode 100644 index 2544c90846..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/FileHelper.java +++ /dev/null @@ -1,704 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.core.util; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.util.regex.Pattern; - -public class FileHelper { - /** - * The extension separator character. - */ - private static final char EXTENSION_SEPARATOR = '.'; - - /** - * The Unix separator character. - */ - private static final char UNIX_SEPARATOR = '/'; - - /** - * The Windows separator character. - */ - private static final char WINDOWS_SEPARATOR = '\\'; - - protected FileHelper() { - } - - /** - * Returns the index of the last directory separator character. - *

- * This method will handle a file in either Unix or Windows format. The - * position of the last forward or backslash is returned. - *

- * The output will be the same irrespective of the machine that the code is - * running on. - * - * @param filename the filename to find the last path separator in, null - * returns -1 - * @return the index of the last separator character, or -1 if there is no - * such character - */ - public static int indexOfLastSeparator(String filename) { - if (filename == null) { - return -1; - } - int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR); - int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR); - return Math.max(lastUnixPos, lastWindowsPos); - } - - /** - * Returns the index of the last extension separator character, which is a - * dot. - *

- * This method also checks that there is no directory separator after the - * last dot. To do this it uses {@link #indexOfLastSeparator(String)} which - * will handle a file in either Unix or Windows format. - *

- * The output will be the same irrespective of the machine that the code is - * running on. - * - * @param filename the filename to find the last path separator in, null - * returns -1 - * @return the index of the last separator character, or -1 if there is no - * such character - */ - public static int indexOfExtension(String filename) { - if (filename == null) { - return -1; - } - int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR); - int lastSeparator = indexOfLastSeparator(filename); - return lastSeparator > extensionPos ? -1 : extensionPos; - } - - /** - * Gets the name minus the path from a full filename. - *

- * This method will handle a file in either Unix or Windows format. The text - * after the last forward or backslash is returned. - * - *

-     * a/b/c.txt --> c.txt
-     * a.txt     --> a.txt
-     * a/b/c     --> c
-     * a/b/c/    --> ""
-     * 
- * - *

- * The output will be the same irrespective of the machine that the code is - * running on. - * - * @param fileName the filename to query, null returns null - * @return the name of the file without the path, or an empty string if none - * exists - */ - public static String getName(String fileName) { - if (fileName == null) { - return null; - } - int index = indexOfLastSeparator(fileName); - return fileName.substring(index + 1); - } - - /** - * Gets the extension of a filename. - *

- * This method returns the textual part of the filename after the last dot. - * There must be no directory separator after the dot. - * - *

-     * foo.txt      --> "txt"
-     * a/b/c.jpg    --> "jpg"
-     * a/b.txt/c    --> ""
-     * a/b/c        --> ""
-     * 
- * - *

- * The output will be the same irrespective of the machine that the code is - * running on. - * - * @param filename the filename to retrieve the extension of. - * @return the extension of the file or an empty string if none exists. - */ - public static String getExtension(String filename) { - if (filename == null) { - return null; - } - int index = indexOfExtension(filename); - if (index == -1) { - return ""; - } else { - return filename.substring(index + 1); - } - } - - /** - * Make a directory, including any necessary but nonexistent parent - * directories. If there already exists a file with specified name or the - * directory cannot be created then an exception is thrown. - * - * @param directory directory to create, not null - * @throws NullPointerException if the directory is null - * @throws IOException if the directory cannot be created - */ - public static void forceMkdir(File directory) throws IOException { - if (directory.exists()) { - if (directory.isFile()) { - String message = - "File " + directory + " exists and is " + "not a directory. Unable to create directory."; - throw new IOException(message); - } - } else { - if (!directory.mkdirs()) { - String message = "Unable to create directory " + directory; - throw new IOException(message); - } - } - } - - /** - * Delete a file. If file is a directory, delete it and all sub-directories. - *

- * The difference between File.delete() and this method are: - *

    - *
  • A directory to be deleted does not have to be empty.
  • - *
  • You get exceptions when a file or directory cannot be deleted. - * (java.io.File methods returns a boolean)
  • - *
- * - * @param file file or directory to delete, not null - * @throws NullPointerException if the directory is null - * @throws IOException in case deletion is unsuccessful - */ - public static void forceDelete(File file) throws IOException { - if (file.isDirectory()) { - deleteDirectory(file); - } else { - if (!file.exists()) { - throw new FileNotFoundException("File does not exist: " + file); - } - if (!file.delete()) { - String message = "Unable to delete file: " + file; - throw new IOException(message); - } - } - } - - /** - * Convert from a URL to a File. - *

- * From version 1.1 this method will decode the URL. Syntax such as - * file:///my%20docs/file.txt will be correctly decoded to - * /my docs/file.txt. - * - * @param url the file URL to convert, null returns null - * @return the equivalent File object, or null - * if the URL's protocol is not file - * @throws IllegalArgumentException if the file is incorrectly encoded - */ - public static File toFile(URL url) { - if (url == null || !url.getProtocol().equals("file")) { - return null; - } else { - String filename = url.getFile().replace('/', File.separatorChar); - int pos = 0; - while ((pos = filename.indexOf('%', pos)) >= 0) { // NOPMD - if (pos + 2 < filename.length()) { - String hexStr = filename.substring(pos + 1, pos + 3); - char ch = (char)Integer.parseInt(hexStr, 16); - filename = filename.substring(0, pos) + ch + filename.substring(pos + 3); - } - } - return new File(filename); - } - } - - public static FileFilter getFileFilter(String regExp, boolean ignoreCase) { - return new RegExpFilter(regExp, ignoreCase); - } - - /** - * A regular-expression based resource filter - */ - public static class RegExpFilter implements FileFilter { - private Pattern pattern; - - public RegExpFilter(Pattern pattern) { - this.pattern = pattern; - } - - public RegExpFilter(String patternStr, boolean ignoreCase) { - this.pattern = Pattern.compile(patternStr, ignoreCase ? Pattern.CASE_INSENSITIVE : 0); - } - - public boolean accept(File file) { - return pattern.matcher(file.getName()).matches(); - } - - /** - * Convert wildcard into a regex pattern - * - * @param str - * @return - */ - public static RegExpFilter getWildcardFilter(String str, boolean ignoreCase) { - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < str.length(); i++) { - char ch = str.charAt(i); - if (ch == '?') { - buffer.append('.'); - } else if (ch == '*') { - buffer.append(".*"); - } else { - buffer.append(ch); - } - } - return new RegExpFilter(buffer.toString(), ignoreCase); - } - - } - - /** - * Clean a directory without deleting it. - * - * @param directory directory to clean - * @throws IOException in case cleaning is unsuccessful - */ - public static void cleanDirectory(File directory) throws IOException { - if (!directory.exists()) { - String message = directory + " does not exist"; - throw new IllegalArgumentException(message); - } - - if (!directory.isDirectory()) { - String message = directory + " is not a directory"; - throw new IllegalArgumentException(message); - } - - File[] files = directory.listFiles(); - if (files == null) { // null if security restricted - throw new IOException("Failed to list contents of " + directory); - } - - IOException exception = null; - for (int i = 0; i < files.length; i++) { - File file = files[i]; - try { - forceDelete(file); - } catch (IOException ioe) { - exception = ioe; - } - } - - if (null != exception) { - throw exception; - } - } - - /** - * Clean a directory without deleting it. - * - * @param directory directory to clean, must not be null - * @throws NullPointerException if the directory is null - * @throws IOException in case cleaning is unsuccessful - */ - private static void cleanDirectoryOnExit(File directory) throws IOException { - if (!directory.exists()) { - String message = directory + " does not exist"; - throw new IllegalArgumentException(message); - } - - if (!directory.isDirectory()) { - String message = directory + " is not a directory"; - throw new IllegalArgumentException(message); - } - - File[] files = directory.listFiles(); - if (files == null) { // null if security restricted - throw new IOException("Failed to list contents of " + directory); - } - - IOException exception = null; - for (int i = 0; i < files.length; i++) { - File file = files[i]; - try { - forceDeleteOnExit(file); - } catch (IOException ioe) { - exception = ioe; - } - } - - if (null != exception) { - throw exception; - } - } - - /** - * Copies a whole directory to a new location preserving the file dates. - *

- * This method copies the specified directory and all its child directories - * and files to the specified destination. The destination is the new - * location and name of the directory. - *

- * The destination directory is created if it does not exist. If the - * destination directory did exist, then this method merges the source with - * the destination, with the source taking precedence. - * - * @param srcDir an existing directory to copy, must not be - * null - * @param destDir the new directory, must not be null - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @since Commons IO 1.1 - */ - public static void copyDirectory(File srcDir, File destDir) throws IOException { - copyDirectory(srcDir, destDir, true); - } - - /** - * Copies a whole directory to a new location. - *

- * This method copies the contents of the specified source directory to - * within the specified destination directory. - *

- * The destination directory is created if it does not exist. If the - * destination directory did exist, then this method merges the source with - * the destination, with the source taking precedence. - * - * @param srcDir an existing directory to copy, must not be - * null - * @param destDir the new directory, must not be null - * @param preserveFileDate true if the file date of the copy should be the - * same as the original - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @since Commons IO 1.1 - */ - public static void copyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException { - if (srcDir == null) { - throw new NullPointerException("Source must not be null"); - } - if (destDir == null) { - throw new NullPointerException("Destination must not be null"); - } - if (!srcDir.exists()) { - throw new FileNotFoundException("Source '" + srcDir + "' does not exist"); - } - if (!srcDir.isDirectory()) { - throw new IOException("Source '" + srcDir + "' exists but is not a directory"); - } - if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) { - throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same"); - } - doCopyDirectory(srcDir, destDir, preserveFileDate); - } - - // ----------------------------------------------------------------------- - /** - * Copies a directory to within another directory preserving the file dates. - *

- * This method copies the source directory and all its contents to a - * directory of the same name in the specified destination directory. - *

- * The destination directory is created if it does not exist. If the - * destination directory did exist, then this method merges the source with - * the destination, with the source taking precedence. - * - * @param srcDir an existing directory to copy, must not be - * null - * @param destDir the directory to place the copy in, must not be - * null - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @since Commons IO 1.2 - */ - public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException { - if (srcDir == null) { - throw new NullPointerException("Source must not be null"); - } - if (!(srcDir.exists() && srcDir.isDirectory())) { - throw new IllegalArgumentException("Source '" + destDir + "' is not a directory"); - } - if (destDir == null) { - throw new NullPointerException("Destination must not be null"); - } - if (!(destDir.exists() && destDir.isDirectory())) { - throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory"); - } - copyDirectory(srcDir, new File(destDir, srcDir.getName()), true); - } - - /** - * Copies a file to a new location preserving the file date. - *

- * This method copies the contents of the specified source file to the - * specified destination file. The directory holding the destination file is - * created if it does not exist. If the destination file exists, then this - * method will overwrite it. - * - * @param srcFile an existing file to copy, must not be null - * @param destFile the new file, must not be null - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @see #copyFileToDirectory(File, File) - */ - public static void copyFile(File srcFile, File destFile) throws IOException { - copyFile(srcFile, destFile, true); - } - - /** - * Copies a file to a new location. - *

- * This method copies the contents of the specified source file to the - * specified destination file. The directory holding the destination file is - * created if it does not exist. If the destination file exists, then this - * method will overwrite it. - * - * @param srcFile an existing file to copy, must not be null - * @param destFile the new file, must not be null - * @param preserveFileDate true if the file date of the copy should be the - * same as the original - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @see #copyFileToDirectory(File, File, boolean) - */ - public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException { - if (srcFile == null) { - throw new NullPointerException("Source must not be null"); - } - if (destFile == null) { - throw new NullPointerException("Destination must not be null"); - } - if (!srcFile.exists()) { - throw new FileNotFoundException("Source '" + srcFile + "' does not exist"); - } - if (srcFile.isDirectory()) { - throw new IOException("Source '" + srcFile + "' exists but is a directory"); - } - if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) { - throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same"); - } - if (!(destFile.getParentFile() != null && destFile.getParentFile().exists())) { - if (!destFile.getParentFile().mkdirs()) { - throw new IOException("Destination '" + destFile + "' directory cannot be created"); - } - } - if (!(destFile.exists() && destFile.canWrite())) { - throw new IOException("Destination '" + destFile + "' exists but is read-only"); - } - doCopyFile(srcFile, destFile, preserveFileDate); - } - - // ----------------------------------------------------------------------- - /** - * Copies a file to a directory preserving the file date. - *

- * This method copies the contents of the specified source file to a file of - * the same name in the specified destination directory. The destination - * directory is created if it does not exist. If the destination file - * exists, then this method will overwrite it. - * - * @param srcFile an existing file to copy, must not be null - * @param destDir the directory to place the copy in, must not be - * null - * @throws NullPointerException if source or destination is null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @see #copyFile(File, File, boolean) - */ - public static void copyFileToDirectory(File srcFile, File destDir) throws IOException { - copyFileToDirectory(srcFile, destDir, true); - } - - /** - * Copies a file to a directory optionally preserving the file date. - *

- * This method copies the contents of the specified source file to a file of - * the same name in the specified destination directory. The destination - * directory is created if it does not exist. If the destination file - * exists, then this method will overwrite it. - * - * @param srcFile an existing file to copy, must not be null - * @param destDir the directory to place the copy in, must not be - * null - * @param preserveFileDate true if the file date of the copy should be the - * same as the original - * @throws NullPointerException if source or destination is - * null - * @throws IOException if source or destination is invalid - * @throws IOException if an IO error occurs during copying - * @see #copyFile(File, File, boolean) - * @since Commons IO 1.3 - */ - public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException { - if (destDir == null) { - throw new NullPointerException("Destination must not be null"); - } - if (!(destDir.exists() && destDir.isDirectory())) { - throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory"); - } - copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate); - } - - // ----------------------------------------------------------------------- - /** - * Recursively delete a directory. - * - * @param directory directory to delete - * @throws IOException in case deletion is unsuccessful - */ - public static void deleteDirectory(File directory) throws IOException { - if (!directory.exists()) { - return; - } - - cleanDirectory(directory); - if (!directory.delete()) { - String message = "Unable to delete directory " + directory + "."; - throw new IOException(message); - } - } - - /** - * Recursively schedule directory for deletion on JVM exit. - * - * @param directory directory to delete, must not be null - * @throws NullPointerException if the directory is null - * @throws IOException in case deletion is unsuccessful - */ - private static void deleteDirectoryOnExit(File directory) throws IOException { - if (!directory.exists()) { - return; - } - - cleanDirectoryOnExit(directory); - directory.deleteOnExit(); - } - - /** - * Internal copy directory method. - * - * @param srcDir the validated source directory, must not be - * null - * @param destDir the validated destination directory, must not be - * null - * @param preserveFileDate whether to preserve the file date - * @throws IOException if an error occurs - * @since Commons IO 1.1 - */ - private static void doCopyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException { - if (destDir.exists()) { - if (!destDir.isDirectory()) { - throw new IOException("Destination '" + destDir + "' exists but is not a directory"); - } - } else { - if (!destDir.mkdirs()) { - throw new IOException("Destination '" + destDir + "' directory cannot be created"); - } - if (preserveFileDate) { - destDir.setLastModified(srcDir.lastModified()); - } - } - if (!destDir.canWrite()) { - throw new IOException("Destination '" + destDir + "' cannot be written to"); - } - // recurse - File[] files = srcDir.listFiles(); - if (files == null) { // null if security restricted - throw new IOException("Failed to list contents of " + srcDir); - } - for (int i = 0; i < files.length; i++) { - File copiedFile = new File(destDir, files[i].getName()); - if (files[i].isDirectory()) { - doCopyDirectory(files[i], copiedFile, preserveFileDate); - } else { - doCopyFile(files[i], copiedFile, preserveFileDate); - } - } - } - - /** - * Internal copy file method. - * - * @param srcFile the validated source file, must not be null - * @param destFile the validated destination file, must not be - * null - * @param preserveFileDate whether to preserve the file date - * @throws IOException if an error occurs - */ - private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException { - if (destFile.exists() && destFile.isDirectory()) { - throw new IOException("Destination '" + destFile + "' exists but is a directory"); - } - - FileInputStream input = new FileInputStream(srcFile); - try { - FileOutputStream output = new FileOutputStream(destFile); - try { - IOHelper.copy(input, output); - } finally { - IOHelper.closeQuietly(output); - } - } finally { - IOHelper.closeQuietly(input); - } - - if (srcFile.length() != destFile.length()) { - throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'"); - } - if (preserveFileDate) { - destFile.setLastModified(srcFile.lastModified()); - } - } - - /** - * Schedule a file to be deleted when JVM exits. If file is directory delete - * it and all sub-directories. - * - * @param file file or directory to delete, must not be null - * @throws NullPointerException if the file is null - * @throws IOException in case deletion is unsuccessful - */ - public static void forceDeleteOnExit(File file) throws IOException { - if (file.isDirectory()) { - deleteDirectoryOnExit(file); - } else { - file.deleteOnExit(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/IOHelper.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/IOHelper.java deleted file mode 100644 index 62a007bd05..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/IOHelper.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.core.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.JarURLConnection; -import java.net.URL; -import java.util.jar.JarFile; - -public class IOHelper { - /** - * The default buffer size to use. - */ - private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; - - protected IOHelper() { - - } - - /** - * Unconditionally close an InputStream. - *

- * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored. - * This is typically used in finally blocks. - * - * @param input the InputStream to close, may be null or already closed - */ - public static void closeQuietly(InputStream input) { - try { - if (input != null) { - input.close(); - } - } catch (IOException ioe) { - // ignore - } - } - - /** - * Unconditionally close an OutputStream. - *

- * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored. - * This is typically used in finally blocks. - * - * @param output the OutputStream to close, may be null or already closed - */ - public static void closeQuietly(OutputStream output) { - try { - if (output != null) { - output.close(); - } - } catch (IOException ioe) { - // ignore - } - } - - /** - * Copy bytes from an InputStream to an - * OutputStream. - *

- * This method buffers the input internally, so there is no need to use a - * BufferedInputStream. - * - * @param input the InputStream to read from - * @param output the OutputStream to write to - * @return the number of bytes copied - * @throws NullPointerException if the input or output is null - * @throws IOException if an I/O error occurs - * @since Commons IO 1.1 - */ - public static int copy(InputStream input, OutputStream output) throws IOException { - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - int count = 0; - int n = 0; - while (-1 != (n = input.read(buffer))) { // NOPMD - output.write(buffer, 0, n); - count += n; - } - return count; - } - - public static InputStream getInputStream(URL url) throws IOException { - return new SafeURLInputStream(url); - } - - /** - * This class is a workaround for URL stream issue as illustrated below. - * InputStream is=url.getInputStream(); is.close(); // This line doesn't close - * the JAR file if the URL is a jar entry like "jar:file:/a.jar!/my.composite" We - * also need to turn off the JarFile cache. - * - * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4950148 - * - * @version $Rev$ $Date$ - */ - public static class SafeURLInputStream extends InputStream { - private JarFile jarFile; - private InputStream is; - - public SafeURLInputStream(URL url) throws IOException { - String protocol = url.getProtocol(); - if (protocol != null && (protocol.equals("jar"))) { - JarURLConnection connection = (JarURLConnection)url.openConnection(); - // We cannot use cache - connection.setUseCaches(false); - try { - is = connection.getInputStream(); - } catch (IOException e) { - throw e; - } - jarFile = connection.getJarFile(); - } else { - is = url.openStream(); - } - } - - public SafeURLInputStream(JarURLConnection connection) throws IOException { - // We cannot use cache - connection.setUseCaches(false); - is = connection.getInputStream(); - jarFile = connection.getJarFile(); - } - - public int available() throws IOException { - return is.available(); - } - - public void close() throws IOException { - is.close(); - // We need to close the JAR file - if (jarFile != null) { - jarFile.close(); - } - } - - public synchronized void mark(int readlimit) { - is.mark(readlimit); - } - - public boolean markSupported() { - return is.markSupported(); - } - - public int read() throws IOException { - return is.read(); - } - - public int read(byte[] b, int off, int len) throws IOException { - return is.read(b, off, len); - } - - public int read(byte[] b) throws IOException { - return is.read(b); - } - - public synchronized void reset() throws IOException { - is.reset(); - } - - public long skip(long n) throws IOException { - return is.skip(n); - } - } -} \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java deleted file mode 100644 index 6b11725481..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.util; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -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 final class JavaIntrospectionHelper { - - private static final Class[] EMPTY_CLASS_ARRY = new Class[0]; - - /** - * Hide the constructor - */ - private JavaIntrospectionHelper() { - } - - - /** - * 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(); - 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 and protected 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 getAllUniquePublicProtectedMethods(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) { - int modifiers = declaredMethod.getModifiers(); - if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) { - continue; - } - 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; - } - - /** - * 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 the implmentation class - */ - 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) { - if (!name.startsWith("set")) { - return 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: - * JavaIntrospectionHelper.getGenerics(field.getGenericType()); - *

- * 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; - } - - /** - * Returns the generic type specified by the class at the given position as in: - *

- * public class Foo{ //.. } - *

- * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); - *

- * will return Baz. - */ - public static Class introspectGeneric(Class clazz, int pos) { - assert clazz != null : "No class specified"; - Type type = clazz.getGenericSuperclass(); - if (type instanceof ParameterizedType) { - Type[] args = ((ParameterizedType) type).getActualTypeArguments(); - if (args.length <= pos) { - throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName()); - } - return (Class) ((ParameterizedType) type).getActualTypeArguments()[pos]; - } else { - Type[] interfaces = clazz.getGenericInterfaces(); - for (Type itype : interfaces) { - if (!(itype instanceof ParameterizedType)) { - continue; - } - ParameterizedType interfaceType = (ParameterizedType) itype; - return (Class) interfaceType.getActualTypeArguments()[0]; - } - } - return null; - } - - /** - * Returns the set of interfaces implemented by the given class and its ancestors or a blank set if none - */ - public static Set getAllInterfaces(Class clazz) { - Set implemented = new HashSet(); - getAllInterfaces(clazz, implemented); - return implemented; - } - - private static void getAllInterfaces(Class clazz, Set implemented) { - Class[] interfaces = clazz.getInterfaces(); - for (Class interfaze : interfaces) { - implemented.add(interfaze); - } - Class superClass = clazz.getSuperclass(); - // Object has no superclass so check for null - if (superClass != null && !superClass.equals(Object.class)) { - getAllInterfaces(superClass, implemented); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java deleted file mode 100644 index c0bf7780f5..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.osoa.sca.NoRegisteredCallbackException; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; - -/** - * An interceptor applied to the forward direction of a wire that ensures the callback target implements the required - * service contract. This is required as callback targets may be set dynamically by service implementations. - * - * @version $Rev$ $Date$ - */ -public class CallbackInterfaceInterceptor implements Interceptor { - private boolean invokingServiceImplements; - private Interceptor next; - - public CallbackInterfaceInterceptor(boolean invokingServiceImplements) { - this.invokingServiceImplements = invokingServiceImplements; - } - - public Message invoke(Message msg) { - // TODO check in the context if a callback object is set, if so invoke next since the setCallback will - // perform the check - if (!invokingServiceImplements) { - throw new NoRegisteredCallbackException("Callback target does not implement the callback interface"); - } - return next.invoke(msg); - } - - public void setNext(Interceptor next) { - this.next = next; - } - - public Interceptor getNext() { - return next; - } - - public boolean isOptimizable() { - return false; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java deleted file mode 100644 index d5fca62e1b..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.io.PrintWriter; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; - -import org.apache.tuscany.host.monitor.ExceptionFormatter; -import org.apache.tuscany.host.monitor.FormatterRegistry; - -/** - * Formats {@link org.apache.tuscany.spi.wire.IncompatibleServiceContractException} for JDK logging - * - * @version $Rev$ $Date$ - */ -@EagerInit -public class IncompatibleServiceContractExceptionFormatter implements ExceptionFormatter { - private FormatterRegistry factory; - - public IncompatibleServiceContractExceptionFormatter(@Reference FormatterRegistry factory) { - this.factory = factory; - factory.register(this); - } - - public boolean canFormat(Class type) { - return IncompatibleServiceContractException.class.isAssignableFrom(type); - } - - @Destroy - public void destroy() { - factory.unregister(this); - } - - public PrintWriter write(PrintWriter writer, Throwable exception) { - assert exception instanceof IncompatibleServiceContractException; - IncompatibleServiceContractException e = (IncompatibleServiceContractException) exception; - e.appendBaseMessage(writer); - ServiceContract source = e.getSource(); - String sourceContractName = null; - if (source != null) { - sourceContractName = source.getInterfaceName(); - } - Operation sourceOperation = e.getSourceOperation(); - String sourceOpName = null; - if (sourceOperation != null) { - sourceOpName = sourceOperation.getName(); - } - if (sourceOpName == null) { - writer.write("\nSource Contract: " + sourceContractName); - } else { - writer.write("\nSource Contract: " + sourceContractName + "/" + sourceOpName); - } - ServiceContract target = e.getTarget(); - String targetContractName = null; - if (target != null) { - targetContractName = target.getInterfaceName(); - } - Operation targetOperation = e.getTargetOperation(); - String targetOpName = null; - if (targetOperation != null) { - targetOpName = targetOperation.getName(); - } - if (targetOpName == null) { - writer.write("\nTarget Contract: " + targetContractName + "\n"); - } else { - writer.write("\nTarget Contract: " + targetContractName + "/" + targetOpName + "\n"); - - } - return writer; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java deleted file mode 100644 index 921b4e37fa..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.TargetInvoker; - -/** - * Default implementation of an invocation chain - * - * @version $Rev$ $Date$ - */ -public class InvocationChainImpl implements InvocationChain { - protected Operation operation; - protected PhysicalOperationDefinition physicalOperation; - protected TargetInvoker targetInvoker; - protected Interceptor interceptorChainHead; - protected Interceptor interceptorChainTail; - - public InvocationChainImpl(PhysicalOperationDefinition operation) { - this.physicalOperation = operation; - } - - public InvocationChainImpl(Operation operation) { - assert operation != null; - this.operation = operation; - } - - public Operation getOperation() { - return operation; - } - - public PhysicalOperationDefinition getPhysicalOperation() { - return physicalOperation; - } - - public void setTargetInvoker(TargetInvoker invoker) { - this.targetInvoker = invoker; - } - - public TargetInvoker getTargetInvoker() { - return targetInvoker; - } - - public void addInterceptor(Interceptor interceptor) { - if (interceptorChainHead == null) { - interceptorChainHead = interceptor; - } else { - interceptorChainTail.setNext(interceptor); - } - interceptorChainTail = interceptor; - } - - public void addInterceptor(int index, Interceptor interceptor) { - int i = 0; - Interceptor next = interceptorChainHead; - Interceptor prev = null; - while (next != null && i < index) { - prev = next; - next = next.getNext(); - i++; - } - if (i == index) { - if (prev != null) { - prev.setNext(interceptor); - } else { - interceptorChainHead = interceptor; - } - interceptor.setNext(next); - if (next == null) { - interceptorChainTail = interceptor; - } - } else { - throw new ArrayIndexOutOfBoundsException(index); - } - } - - public Interceptor getHeadInterceptor() { - return interceptorChainHead; - } - - public Interceptor getTailInterceptor() { - return interceptorChainTail; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java deleted file mode 100644 index 10cc254451..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.TargetInvoker; - -/** - * 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. - * - * @version $Rev$ $Date$ - * @Deprecated - * @see org.apache.tuscany.spi.wire.TargetInvoker - */ -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"); - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return true; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java deleted file mode 100644 index aec281d190..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.wire.ProxyCreationException; - -/** - * Thrown when an {@link org.apache.tuscany.spi.model.Operation} cannot be mapped to a method on an interface - * @version $Rev$ $Date$ - */ -public class NoMethodForOperationException extends ProxyCreationException { - public NoMethodForOperationException() { - } - - public NoMethodForOperationException(String message) { - super(message); - } - - public NoMethodForOperationException(String message, Throwable cause) { - super(message, cause); - } - - public NoMethodForOperationException(Throwable cause) { - super(cause); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptor.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptor.java deleted file mode 100644 index d4848cde71..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptor.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.net.URI; -import java.util.LinkedList; - -import org.osoa.sca.ServiceRuntimeException; - -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.work.WorkScheduler; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Adds non-blocking behavior to an invocation chain - * - * @version $$Rev$$ $$Date$$ - */ -public class NonBlockingInterceptor implements Interceptor { - - private static final Message RESPONSE = new ImmutableMessage(); - - private WorkScheduler workScheduler; - private WorkContext workContext; - private Interceptor next; - - public NonBlockingInterceptor(WorkScheduler workScheduler, WorkContext workContext) { - this.workScheduler = workScheduler; - this.workContext = workContext; - } - - public NonBlockingInterceptor(WorkScheduler workScheduler, WorkContext workContext, Interceptor next) { - this.workScheduler = workScheduler; - this.workContext = workContext; - this.next = next; - } - - public Message invoke(final Message msg) { - // Retrieve conversation id to transfer to new thread - // Notice that we cannot clear the conversation id from the current thread - final Object conversationID = workContext.getIdentifier(Scope.CONVERSATION); - // Schedule the invocation of the next interceptor in a new Work instance - try { - workScheduler.scheduleWork(new Runnable() { - public void run() { - workContext.setCorrelationId(null); - // if we got a conversation id, transfer it to new thread - if (conversationID != null) { - workContext.setIdentifier(Scope.CONVERSATION, conversationID); - } - next.invoke(msg); - } - }); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - return RESPONSE; - } - - public Interceptor getNext() { - return next; - } - - public void setNext(Interceptor next) { - this.next = next; - } - - public boolean isOptimizable() { - return false; - } - - /** - * A dummy message passed back on an invocation - */ - private static class ImmutableMessage implements Message { - - public Object getBody() { - return null; - } - - public void setBody(Object body) { - if (body != null) { - throw new UnsupportedOperationException(); - } - } - - public WorkContext getWorkContext() { - throw new UnsupportedOperationException(); - } - - public void setWorkContext(WorkContext workContext) { - throw new UnsupportedOperationException(); - } - - public void setTargetInvoker(TargetInvoker invoker) { - throw new UnsupportedOperationException(); - } - - public TargetInvoker getTargetInvoker() { - return null; - } - - public Message getRelatedCallbackMessage() { - return null; - } - - public URI getFromAddress() { - return null; - } - - public void setFromAddress(URI fromAddress) { - throw new UnsupportedOperationException(); - } - - public void pushCallbackUri(URI fromAddress) { - throw new UnsupportedOperationException(); - } - - public LinkedList getCallbackUris() { - return null; - } - - public void setCallbackUris(LinkedList uris) { - throw new UnsupportedOperationException(); - } - - public void pushCallbackWire(Wire wire) { - - } - - public LinkedList getCallbackWires() { - return null; - } - - public void setCallbackWires(LinkedList wires) { - - } - - public Object getMessageId() { - return null; - } - - public void setMessageId(Object messageId) { - throw new UnsupportedOperationException(); - } - - public Object getCorrelationId() { - return null; - } - - public void setCorrelationId(Object correlationId) { - throw new UnsupportedOperationException(); - } - - public boolean isFault() { - return false; - } - - public void setBodyWithFault(Object fault) { - throw new UnsupportedOperationException(); - } - - public short getConversationSequence() { - return TargetInvoker.NONE; - } - - public void setConversationSequence(short sequence) { - - } - - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java deleted file mode 100644 index 8afcf8f6ad..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import javax.xml.namespace.QName; - -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.extension.InterceptorBuilderExtension; -import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition; -import org.apache.tuscany.spi.services.work.WorkScheduler; -import org.apache.tuscany.spi.wire.Interceptor; - -/** - * Creates a non-blocking interceptor - * - * @version $Rev$ $Date$ - */ -public class NonBlockingInterceptorBuilder extends InterceptorBuilderExtension { - public static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/sca/system/2.0-alpha", "nonblocking"); - private WorkContext workContext; - private WorkScheduler scheduler; - - public NonBlockingInterceptorBuilder(@Reference(required = true)WorkContext workContext, - @Reference(required = true)WorkScheduler scheduler) { - this.workContext = workContext; - this.scheduler = scheduler; - } - - public Interceptor build(PhysicalInterceptorDefinition definition) throws BuilderException { - return new NonBlockingInterceptor(scheduler, workContext); - } - - protected QName getName() { - return QNAME; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java deleted file mode 100644 index ab958234bd..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.ObjectCreationException; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Returns a target instance directly from a wire - * - * @version $Rev$ $Date$ - * @Deprecated - */ -public class OptimizedWireObjectFactory implements ObjectFactory { - private final Class type; - private Wire wire; - - public OptimizedWireObjectFactory(Class type, Wire factory) { - this.wire = factory; - this.type = type; - } - - public B getInstance() throws ObjectCreationException { - try { - return type.cast(wire.getTargetInstance()); - } catch (TargetResolutionException e) { - throw new ObjectCreationException(e); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/ProxyServiceExtension.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/ProxyServiceExtension.java deleted file mode 100644 index 7c8cf0db3a..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/ProxyServiceExtension.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; -import org.apache.tuscany.spi.wire.ProxyService; - -/** - * Base class for wire service extensions - * - * @version $Rev$ $Date$ - */ -public abstract class ProxyServiceExtension implements ProxyService { - protected WorkContext context; - - protected ProxyServiceExtension(WorkContext context) { - this.context = context; - } - - public boolean checkCompatibility(ServiceContract source, - ServiceContract target, - boolean ignoreCallback, - boolean silent) - throws IncompatibleServiceContractException { - if (source == target) { - // Shortcut for performance - return true; - } - if (source.isRemotable() != target.isRemotable()) { - if (!silent) { - throw new IncompatibleServiceContractException("Remotable settings do not match", source, target); - } else { - return false; - } - } - if (source.isConversational() != target.isConversational()) { - if (!silent) { - throw new IncompatibleServiceContractException("Interaction scopes do not match", source, target); - } else { - return false; - } - } - - for (Operation operation : source.getOperations().values()) { - Operation targetOperation = target.getOperations().get(operation.getName()); - if (targetOperation == null) { - if (!silent) { - throw new IncompatibleServiceContractException("Operation not found on target", source, target); - } else { - return false; - } - } - if (!operation.equals(targetOperation)) { - if (!silent) { - throw new IncompatibleServiceContractException("Target operations are not compatible", source, - target); - } else { - return false; - } - } - } - - if (ignoreCallback) { - return true; - } - - for (Operation operation : source.getCallbackOperations().values()) { - Operation targetOperation = target.getCallbackOperations().get(operation.getName()); - if (targetOperation == null) { - if (!silent) { - throw new IncompatibleServiceContractException("Callback operation not found on target", - source, - target, - null, - targetOperation); - } else { - return false; - } - } - if (!operation.equals(targetOperation)) { - if (!silent) { - throw new IncompatibleServiceContractException("Target callback operation is not compatible", - source, - target, - operation, - targetOperation); - } else { - return false; - } - } - } - return true; - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireImpl.java deleted file mode 100644 index 7f748a15db..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.net.URI; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Default implementation of a Wire - * - * @version $Rev$ $Date$ - */ -public class WireImpl implements Wire { - private URI sourceUri; - private URI targetUri; - private QName bindingType; - private ServiceContract sourceContract; - private ServiceContract targetContract; - private boolean optimizable; - private Map, InvocationChain> chains = new HashMap, InvocationChain>(); - private Map, InvocationChain> callbackChains = new HashMap, InvocationChain>(); - private Map pChains = - new HashMap(); - private Map pCallbackChains = - new HashMap(); - private AtomicComponent target; - - /** - * Creates a wire with a local binding - */ - public WireImpl() { - } - - /** - * Creates a wire with the given binding type - * - * @param bindingType the binding type - */ - public WireImpl(QName bindingType) { - this.bindingType = bindingType; - } - - public URI getSourceUri() { - return sourceUri; - } - - public void setSourceUri(URI sourceUri) { - this.sourceUri = sourceUri; - } - - public URI getTargetUri() { - return targetUri; - } - - public void setTargetUri(URI targetUri) { - this.targetUri = targetUri; - } - - public QName getBindingType() { - return bindingType; - } - - - public ServiceContract getSourceContract() { - return sourceContract; - } - - public void setSourceContract(ServiceContract contract) { - this.sourceContract = contract; - } - - - public ServiceContract getTargetContract() { - return targetContract; - } - - public void setTargetContract(ServiceContract contract) { - this.targetContract = contract; - } - - public boolean isOptimizable() { - return optimizable; - } - - public void setOptimizable(boolean optimizable) { - this.optimizable = optimizable; - } - - public Object getTargetInstance() throws TargetResolutionException { - if (target == null) { - return null; - } - return target.getTargetInstance(); - } - - public void setTarget(AtomicComponent target) { - this.target = target; - } - - public Map, InvocationChain> getInvocationChains() { - return Collections.unmodifiableMap(chains); - } - - public void addInvocationChain(Operation operation, InvocationChain chain) { - chains.put(operation, chain); - } - - public void addInvocationChain(PhysicalOperationDefinition operation, InvocationChain chain) { - pChains.put(operation, chain); - } - - public Map getPhysicalInvocationChains() { - return Collections.unmodifiableMap(pChains); - } - - public Map, InvocationChain> getCallbackInvocationChains() { - return Collections.unmodifiableMap(callbackChains); - } - - public void addCallbackInvocationChain(Operation operation, InvocationChain chain) { - callbackChains.put(operation, chain); - } - - public Map getCallbackPhysicalInvocationChains() { - return Collections.unmodifiableMap(pCallbackChains); - } - - public void addCallbackInvocationChain(PhysicalOperationDefinition operation, InvocationChain chain) { - pCallbackChains.put(operation, chain); - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java deleted file mode 100644 index 3d14138d56..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.ObjectCreationException; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.ProxyService; - -/** - * Uses a wire to return an object instance - * @Deprecated - * - * @version $Rev$ $Date$ - */ -public class WireObjectFactory implements ObjectFactory { - private Class interfaze; - private Wire wire; - private ProxyService proxyService; - // the cache of proxy interface method to operation mappings - private Map mappings; - private boolean optimizable; - - /** - * Constructor. - * - * @param interfaze the interface to inject on the client - * @param wire the backing wire - * @param proxyService the wire service to create the proxy - * @throws NoMethodForOperationException - */ - public WireObjectFactory(Class interfaze, Wire wire, ProxyService proxyService) - throws NoMethodForOperationException { - this.interfaze = interfaze; - this.wire = wire; - this.proxyService = proxyService; - this.mappings = WireUtils.createInterfaceToWireMapping(interfaze, wire); - if (wire.isOptimizable() - && wire.getSourceContract().getInterfaceClass() != null - && interfaze.isAssignableFrom(wire.getSourceContract().getInterfaceClass())) { - optimizable = true; - } - } - - public T getInstance() throws ObjectCreationException { - if (optimizable) { - try { - return interfaze.cast(wire.getTargetInstance()); - } catch (TargetResolutionException e) { - throw new ObjectCreationException(e); - } - } else { - // clone the cached mappings - Map newChains = new HashMap(mappings.size()); - for (Map.Entry entry : mappings.entrySet()) { - newChains.put(entry.getKey(), entry.getValue().clone()); - } - return interfaze.cast(proxyService.createProxy(interfaze, wire, newChains)); - } - } - - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory2.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory2.java deleted file mode 100644 index b5fab62d2f..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory2.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.tuscany.spi.ObjectCreationException; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.ProxyService; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Uses a wire to return an object instance - * - * @version $Rev$ $Date$ - */ -public class WireObjectFactory2 implements ObjectFactory { - private Class interfaze; - private boolean conversational; - private Wire wire; - private ProxyService proxyService; - // the cache of proxy interface method to operation mappings - private Map mappings; - - /** - * Constructor. - * - * @param interfaze the interface to inject on the client - * @param conversational if the wire is conversational - * @param wire the backing wire - * @param proxyService the wire service to create the proxy - * @throws NoMethodForOperationException if a method matching the operation cannot be found - */ - public WireObjectFactory2(Class interfaze, boolean conversational, Wire wire, ProxyService proxyService) - throws NoMethodForOperationException { - this.interfaze = interfaze; - this.conversational = conversational; - this.wire = wire; - this.proxyService = proxyService; - this.mappings = WireUtils.createInterfaceToWireMapping2(interfaze, wire); - } - - public T getInstance() throws ObjectCreationException { - return interfaze.cast(proxyService.createProxy2(interfaze, conversational, wire)); - } -} - diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireUtils.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireUtils.java deleted file mode 100644 index 8b839dc8df..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/wire/WireUtils.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod; -import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod2; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.ProxyCreationException; -import org.apache.tuscany.spi.wire.Wire; - -/** - * Utilities for operating on wires - * - * @version $Rev$ $Date$ - */ -public final class WireUtils { - - private WireUtils() { - } - - - /** - * Maps methods on an interface to operations on a wire - * - * @param interfaze the interface to map from - * @param wire the wire to map to - * @return a collection of method to operation mappings - * @throws NoMethodForOperationException - * @Deprecated - */ - public static Map createInterfaceToWireMapping(Class interfaze, Wire wire) - throws NoMethodForOperationException { - Map, InvocationChain> invocationChains = wire.getInvocationChains(); - - Map chains = new HashMap(invocationChains.size()); - for (Map.Entry, InvocationChain> entry : invocationChains.entrySet()) { - Operation operation = entry.getKey(); - try { - Method method = findMethod(interfaze, operation); - chains.put(method, new ChainHolder(entry.getValue())); - } catch (NoSuchMethodException e) { - throw new NoMethodForOperationException(operation.getName()); - } - } - return chains; - } - - public static Map createInterfaceToWireMapping2(Class interfaze, Wire wire) - throws NoMethodForOperationException { - Map invocationChains = wire.getPhysicalInvocationChains(); - - Map chains = new HashMap(invocationChains.size()); - for (Map.Entry entry : invocationChains.entrySet()) { - PhysicalOperationDefinition operation = entry.getKey(); - try { - Method method = findMethod2(interfaze, operation); - chains.put(method, entry.getValue()); - } catch (NoSuchMethodException e) { - throw new NoMethodForOperationException(operation.getName()); - } catch (ClassNotFoundException e) { - throw new ProxyCreationException(e); - } - } - return chains; - } - - /** - * Determines if the given wire is optimizable, i.e. its invocation chains may be bypassed during an invocation. - * This is typically calculated during the connect phase to optimize away invocation chains. - * - * @param wire the wire - * @return true if the wire is optimizable - */ - public static boolean isOptimizable(Wire wire) { - for (InvocationChain chain : wire.getInvocationChains().values()) { - if (chain.getHeadInterceptor() != null) { - Interceptor current = chain.getHeadInterceptor(); - if (current == null) { - break; - } - while (current != null) { - if (!current.isOptimizable()) { - return false; - } - current = current.getNext(); - } - } - } - // if there is a callback, the wire is never optimizable since the callback target needs to be disambiguated - return wire.getCallbackInvocationChains().isEmpty(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/composite.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/composite.scdl deleted file mode 100644 index 8cdf0ac2a8..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/composite.scdl +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/deployment.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/deployment.scdl deleted file mode 100644 index 804bd0bead..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/deployment.scdl +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - target/deployables - - - - - - - target/repository - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/formatters.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/formatters.scdl deleted file mode 100644 index 5d2c0db012..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/formatters.scdl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/implementation.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/implementation.scdl deleted file mode 100644 index c81115aafa..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/implementation.scdl +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl deleted file mode 100644 index b0664dc67a..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl deleted file mode 100644 index 69110ec05c..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/loader.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/loader.scdl deleted file mode 100644 index b22f5d05f1..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/loader.scdl +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl b/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl deleted file mode 100644 index 9a4178118f..0000000000 --- a/sandbox/rfeng/minicore/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java deleted file mode 100644 index dfda132671..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.TargetInvoker; - -import junit.framework.TestCase; -import org.apache.tuscany.core.mock.wire.MockTargetInvoker; -import org.easymock.EasyMock; -import org.easymock.IAnswer; - -/** - * @version $Rev$ $Date$ - */ -public class AbstractLocalTargetInvokerTestCase extends TestCase { - - public void testInvokerWithInterceptor() throws Throwable { - AbstractLocalTargetInvoker invoker = new MockTargetInvoker(); - Interceptor interceptor = EasyMock.createMock(Interceptor.class); - interceptor.invoke(EasyMock.isA(Message.class)); - EasyMock.expectLastCall().andStubAnswer(new IAnswer() { - public Object answer() throws Throwable { - Message msg = (Message) EasyMock.getCurrentArguments()[0]; - if (msg.getTargetInvoker() == null) { - fail("Target invoker not set"); - } - return null; - } - }); - EasyMock.replay(interceptor); - InvocationChain chain = EasyMock.createMock(InvocationChain.class); - EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor); - EasyMock.replay(chain); - invoker.invoke(chain, EasyMock.createNiceMock(TargetInvoker.class), new MessageImpl()); - EasyMock.verify(chain); - EasyMock.verify(interceptor); - } - - public void testShortCircuitInvoke() throws Throwable { - AbstractLocalTargetInvoker invoker = new MockTargetInvoker(); - TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class); - EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl()); - EasyMock.replay(targetInvoker); - InvocationChain chain = EasyMock.createMock(InvocationChain.class); - EasyMock.expect(chain.getHeadInterceptor()).andReturn(null); - EasyMock.replay(chain); - invoker.invoke(chain, targetInvoker, new MessageImpl()); - EasyMock.verify(chain); - EasyMock.verify(targetInvoker); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java deleted file mode 100644 index e628df47e2..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; - -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.model.ServiceDefinition; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class LocalBindingBuilderTestCase extends TestCase { - - public void testBuild() throws Exception { - LocalBindingBuilder builder = new LocalBindingBuilder(); - ServiceDefinition def = new ServiceDefinition(); - def.setUri(new URI("#foo")); - ServiceBinding binding = builder.build(def, null, null); - assertEquals(LocalServiceBinding.class, binding.getClass()); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java deleted file mode 100644 index 0c35ae9a09..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.spi.loader.LoaderException; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class LocalBindingLoaderTestCase extends TestCase { - private LocalBindingLoader loader; - - public void testParse() throws Exception { - XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class); - EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn("foo"); - EasyMock.replay(reader); - LocalBindingDefinition definition = loader.load(null, reader, null); - assertEquals(new URI("foo"), definition.getTargetUri()); - EasyMock.verify(reader); - } - - public void testNoUri() throws Exception { - XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class); - EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn(null); - EasyMock.replay(reader); - LocalBindingDefinition definition = loader.load(null, reader, null); - assertNull(definition.getTargetUri()); - EasyMock.verify(reader); - } - - public void testBadUri() throws Exception { - XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class); - EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn("foo foo"); - EasyMock.replay(reader); - try { - loader.load(null, reader, null); - fail(); - } catch (LoaderException e) { - // expected - } - EasyMock.verify(reader); - } - - protected void setUp() throws Exception { - super.setUp(); - loader = new LocalBindingLoader(null); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java deleted file mode 100644 index 9b83d95918..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.InvocationChainImpl; -import org.apache.tuscany.core.wire.WireImpl; - -/** - * @version $Rev$ $Date$ - */ -public class LocalCallbackTargetInvokerInvocationExceptionTestCase extends TestCase { - - /** - * Verfies an InvocationTargetException thrown when invoking the target is propagated to the client correctly and - * the originating error is unwrapped - */ - public void testThrowableTargetInvocation() throws Exception { - Operation operation = new Operation("echo", null, null, null); - Interceptor head = new ErrorInterceptor(); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(head); - Wire wire = new WireImpl(); - wire.addCallbackInvocationChain(operation, chain); - LocalCallbackTargetInvoker invoker = new LocalCallbackTargetInvoker(operation, wire); - Message msg = new MessageImpl(); - msg.setBody("foo"); - Message response = invoker.invoke(msg); - assertTrue(response.isFault()); - Object body = response.getBody(); - assertTrue(SomeException.class.equals(body.getClass())); - } - - private class SomeException extends Exception { - - } - - private class ErrorInterceptor implements Interceptor { - - public Message invoke(Message msg) { - msg.setBodyWithFault(new SomeException()); - return msg; - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return false; - } - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java deleted file mode 100644 index d922ec8033..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.lang.reflect.Type; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class LocalCallbackTargetInvokerTestCase extends TestCase { - private Wire wire; - private Message message; - private InvocationChain chain; - private Interceptor head; - private LocalCallbackTargetInvoker invoker; - - /** - * Verfies the normal execution path through a callback - */ - public void testNormalPathMessageInvocation() throws Exception { - Message response = invoker.invoke(message); - assertEquals("response", response.getBody()); - EasyMock.verify(wire); - EasyMock.verify(chain); - EasyMock.verify(head); - } - - protected void setUp() throws Exception { - super.setUp(); - URI targetAddress = URI.create("from"); - message = new MessageImpl(); - message.pushCallbackUri(targetAddress); - message.setBody("foo"); - Message response = new MessageImpl(); - response.setBody("response"); - Operation operation = new Operation("echo", null, null, null); - head = EasyMock.createMock(Interceptor.class); - EasyMock.expect(head.invoke(EasyMock.isA(Message.class))).andReturn(response); - EasyMock.replay(head); - chain = EasyMock.createMock(InvocationChain.class); - EasyMock.expect(chain.getTargetInvoker()).andReturn(null); - EasyMock.expect(chain.getHeadInterceptor()).andReturn(head); - EasyMock.replay(chain); - Map, InvocationChain> chains = new HashMap, InvocationChain>(); - chains.put(operation, chain); - wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.getCallbackInvocationChains()).andReturn(chains); - EasyMock.replay(wire); - - invoker = new LocalCallbackTargetInvoker(operation, wire); - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java deleted file mode 100644 index 0c06842a60..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.InvocationChainImpl; -import org.apache.tuscany.core.wire.WireImpl; - -/** - * @version $Rev$ $Date$ - */ -public class LocalCallbackTargetInvokerThrowableTestCase extends TestCase { - private LocalCallbackTargetInvoker invoker; - - /** - * Verfies an exception thrown in the target is propagated to the client correctly - */ - public void testThrowableTargetInvocation() throws Exception { - Message message = new MessageImpl(); - message.setBody("foo"); - Message response = invoker.invoke(message); - assertTrue(response.isFault()); - Object body = response.getBody(); - if (!(body instanceof InsidiousException)) { - fail(); - } - } - - @SuppressWarnings("unchecked") - protected void setUp() throws Exception { - super.setUp(); - Operation operation = new Operation("echo", null, null, null); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(new InsidiuousInterceptor()); - Wire wire = new WireImpl(); - wire.addCallbackInvocationChain(operation, chain); - invoker = new LocalCallbackTargetInvoker(operation, wire); - } - - private class InsidiousException extends RuntimeException { - - } - - private class InsidiuousInterceptor implements Interceptor { - - public Message invoke(Message msg) throws InsidiousException { - throw new InsidiousException(); - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return false; - } - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java deleted file mode 100644 index e49447164d..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.binding.local; - -import java.net.URI; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.InvocationChainImpl; -import org.apache.tuscany.core.wire.WireImpl; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class LocalTargetInvokerTestCase extends TestCase { - private ServiceContract serviceContract; - private Operation operation; - - public void testInvoke() { - TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class); - EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl()); - EasyMock.replay(targetInvoker); - InvocationChain chain = new InvocationChainImpl(operation); - chain.setTargetInvoker(targetInvoker); - Wire wire = new WireImpl(); - wire.addInvocationChain(operation, chain); - wire.setSourceContract(serviceContract); - TargetInvoker invoker = new LocalTargetInvoker(operation, wire); - Message msg = invoker.invoke(new MessageImpl()); - assertFalse(msg.isFault()); - EasyMock.verify(targetInvoker); - } - - public void testCallbackSetInvoke() { - ServiceContract contract = new ServiceContract() { - - }; - contract.setCallbackClass(Object.class); - TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class); - EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl()); - EasyMock.replay(targetInvoker); - - InvocationChain chain = new InvocationChainImpl(operation); - chain.setTargetInvoker(targetInvoker); - InvocationChain callbackChain = new InvocationChainImpl(operation); - Wire wire = new WireImpl(); - wire.addInvocationChain(operation, chain); - wire.addCallbackInvocationChain(operation, callbackChain); - wire.setSourceContract(serviceContract); - URI uri = URI.create("foo"); - wire.setSourceUri(uri); - wire.addInvocationChain(operation, chain); - TargetInvoker invoker = new LocalTargetInvoker(operation, wire); - Message msg = EasyMock.createMock(Message.class); - msg.pushCallbackUri(EasyMock.eq(uri)); - EasyMock.replay(msg); - invoker.invoke(msg); - EasyMock.verify(msg); - EasyMock.verify(targetInvoker); - } - - public void testFaultInvoke() { - TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class); - EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andThrow(new TestException()); - EasyMock.replay(targetInvoker); - - InvocationChain chain = new InvocationChainImpl(operation); - chain.setTargetInvoker(targetInvoker); - Wire wire = new WireImpl(); - wire.setSourceContract(serviceContract); - wire.addInvocationChain(operation, chain); - TargetInvoker invoker = new LocalTargetInvoker(operation, wire); - Message msg = invoker.invoke(new MessageImpl()); - assertTrue(msg.isFault()); - assertTrue(msg.getBody() instanceof TestException); - EasyMock.verify(targetInvoker); - } - - - protected void setUp() throws Exception { - super.setUp(); - serviceContract = new ServiceContract() { - }; - operation = new Operation("foo", null, null, null); - } - - - private class TestException extends RuntimeException { - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java deleted file mode 100644 index f13ed3367d..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.model.Multiplicity; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceDefinition; - -import junit.framework.TestCase; -import org.apache.tuscany.core.binding.local.LocalBindingBuilder; -import org.apache.tuscany.core.binding.local.LocalBindingDefinition; -import org.apache.tuscany.core.binding.local.LocalReferenceBinding; -import org.apache.tuscany.core.binding.local.LocalServiceBinding; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class BuilderRegistryNoBindingsTestCase extends TestCase { - private DeploymentContext deploymentContext; - private Component parent; - private BuilderRegistry registry; - - public void testNoServiceBindings() throws Exception { - ServiceBinding binding = EasyMock.createNiceMock(ServiceBinding.class); - EasyMock.replay(binding); - ServiceDefinition definition = new ServiceDefinition(URI.create("#foo"), null, false); - definition.setTarget(new URI("foo")); - EasyMock.replay(deploymentContext); - EasyMock.replay(parent); - - Service service = registry.build(definition, deploymentContext); - - assertEquals(1, service.getServiceBindings().size()); - assertTrue(service.getServiceBindings().get(0) instanceof LocalServiceBinding); - EasyMock.verify(deploymentContext); - EasyMock.verify(parent); - } - - public void testReferenceBindingBuilderDispatch() throws Exception { - ReferenceBinding binding = EasyMock.createNiceMock(ReferenceBinding.class); - EasyMock.replay(binding); - ReferenceDefinition definition = new ReferenceDefinition(URI.create("#foo"), null, Multiplicity.ONE_ONE); - EasyMock.replay(deploymentContext); - EasyMock.replay(parent); - - Reference reference = registry.build(definition, deploymentContext); - - assertEquals(1, reference.getReferenceBindings().size()); - assertTrue(reference.getReferenceBindings().get(0) instanceof LocalReferenceBinding); - EasyMock.verify(deploymentContext); - EasyMock.verify(parent); - } - - protected void setUp() throws Exception { - super.setUp(); - deploymentContext = EasyMock.createMock(DeploymentContext.class); - parent = EasyMock.createNiceMock(Component.class); - registry = new BuilderRegistryImpl(null); - registry.register(LocalBindingDefinition.class, new LocalBindingBuilder()); - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java deleted file mode 100644 index 34173154b8..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; -import java.util.Map; - -import org.apache.tuscany.spi.builder.BindingBuilder; -import org.apache.tuscany.spi.builder.BuilderConfigException; -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.builder.ComponentBuilder; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.model.BindingDefinition; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; -import org.apache.tuscany.spi.model.Implementation; -import static org.apache.tuscany.spi.model.Multiplicity.ONE_ONE; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.model.ServiceDefinition; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class BuilderRegistryTestCase extends TestCase { - private DeploymentContext deploymentContext; - private ScopeContainer scopeContainer; - private Map components; - - //private BuilderRegistryImpl registry; - private Component parent; - - @SuppressWarnings({"unchecked"}) - public void testRegistration() throws Exception { - URI componentId = URI.create("sca://localhost/component"); - CompositeImplementation implementation = new CompositeImplementation(); - ComponentDefinition componentDefinition = - new ComponentDefinition(implementation); - componentDefinition.getImplementation().setComponentType(new CompositeComponentType()); - - Component component = EasyMock.createMock(Component.class); - component.setDefaultPropertyValues(componentDefinition.getPropertyValues()); - component.setScopeContainer(scopeContainer); - EasyMock.expect(component.getUri()).andReturn(componentId); - EasyMock.replay(component); - - EasyMock.expect(deploymentContext.getCompositeScope()).andReturn(scopeContainer); - EasyMock.expect(deploymentContext.getComponents()).andReturn(components); - EasyMock.replay(deploymentContext); - - EasyMock.expect(components.put(componentId, component)).andReturn(null); - EasyMock.replay(components); - - ComponentBuilder builder = EasyMock.createMock(ComponentBuilder.class); - EasyMock.expect(builder.build(componentDefinition, deploymentContext)).andReturn(component); - EasyMock.replay(builder); - - BuilderRegistry registry = new BuilderRegistryImpl(null); - registry.register(CompositeImplementation.class, builder); - - assertSame(component, registry.build(componentDefinition, deploymentContext)); - EasyMock.verify(builder); - } - - @SuppressWarnings({"unchecked"}) - public void testServiceBindingBuilderDispatch() throws Exception { - BuilderRegistry registry = new BuilderRegistryImpl(null); - ServiceBinding binding = EasyMock.createNiceMock(ServiceBinding.class); - EasyMock.replay(binding); - BindingBuilder builder = EasyMock.createMock(BindingBuilder.class); - EasyMock.expect(builder.build( - EasyMock.isA(ServiceDefinition.class), - EasyMock.isA(MockBindingDefinition.class), - EasyMock.isA(DeploymentContext.class))).andReturn(binding).times(2); - EasyMock.replay(builder); - registry.register(MockBindingDefinition.class, builder); - ServiceDefinition definition = new ServiceDefinition(URI.create("#foo"), null, false); - definition.addBinding(new MockBindingDefinition()); - definition.addBinding(new MockBindingDefinition()); - definition.setTarget(new URI("foo")); - Service service = registry.build(definition, deploymentContext); - assertEquals(2, service.getServiceBindings().size()); - } - - @SuppressWarnings({"unchecked"}) - public void testReferenceBindingBuilderDispatch() throws Exception { - BuilderRegistry registry = new BuilderRegistryImpl(null); - ReferenceBinding binding = EasyMock.createNiceMock(ReferenceBinding.class); - EasyMock.replay(binding); - BindingBuilder builder = EasyMock.createMock(BindingBuilder.class); - EasyMock.expect(builder.build( - EasyMock.isA(ReferenceDefinition.class), - EasyMock.isA(MockBindingDefinition.class), - EasyMock.isA(DeploymentContext.class))).andReturn(binding).times(2); - EasyMock.replay(builder); - registry.register(MockBindingDefinition.class, builder); - ReferenceDefinition definition = new ReferenceDefinition(URI.create("#foo"), null, ONE_ONE); - definition.addBinding(new MockBindingDefinition()); - definition.addBinding(new MockBindingDefinition()); - Reference reference = registry.build(definition, deploymentContext); - assertEquals(2, reference.getReferenceBindings().size()); - } - - @SuppressWarnings({"unchecked"}) - public void testNoConversationalContract() throws Exception { - ScopeRegistry scopeRegistry = EasyMock.createMock(ScopeRegistry.class); - ScopeContainer scopeContainer = EasyMock.createNiceMock(ScopeContainer.class); - EasyMock.expect(scopeRegistry.getScopeContainer(EasyMock.isA(Scope.class))).andReturn(scopeContainer); - EasyMock.replay(scopeRegistry); - BuilderRegistry registry = new BuilderRegistryImpl(scopeRegistry); - - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - ComponentBuilder builder = EasyMock.createMock(ComponentBuilder.class); - EasyMock.expect(builder.build( - EasyMock.isA(ComponentDefinition.class), - EasyMock.isA(DeploymentContext.class))).andReturn(component); - EasyMock.replay(builder); - registry.register(FooImplementation.class, builder); - - FooImplementation impl = new FooImplementation(); - ComponentType componentType = new ComponentType(); - componentType.setImplementationScope(Scope.CONVERSATION); - impl.setComponentType(componentType); - URI uri = URI.create("foo"); - ComponentDefinition definition = new ComponentDefinition(uri, impl); - try { - registry.build(definition, deploymentContext); - fail("Should throw NoConversationalContractException"); - } catch (NoConversationalContractException e) { - // expected - } - } - - @SuppressWarnings({"unchecked"}) - protected void setUp() throws Exception { - super.setUp(); - deploymentContext = EasyMock.createMock(DeploymentContext.class); - parent = EasyMock.createNiceMock(Component.class); - scopeContainer = EasyMock.createMock(ScopeContainer.class); - components = EasyMock.createMock(Map.class); - } - - private class MockBuilder implements ComponentBuilder { - public Component build( - ComponentDefinition componentDefinition, - DeploymentContext deploymentContext) throws BuilderConfigException { - return null; - } - } - - private class MockBindingDefinition extends BindingDefinition { - - } - - private class FooImplementation extends Implementation { - - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java deleted file mode 100644 index 4c4e1a32b0..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.lang.reflect.Type; -import java.net.URI; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.apache.tuscany.core.component.ComponentManagerImpl; -import org.apache.tuscany.core.wire.InvokerInterceptor; -import org.apache.tuscany.core.wire.NonBlockingInterceptor; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ConnectorImplTestCase extends TestCase { - private TestConnector connector; - private ComponentManager manager; - - public void testConnectTargetNotFound() throws Exception { - Implementation>> impl = - new Implementation>>() { - }; - ComponentType> type = - new ComponentType>(); - URI refUri = URI.create("ref"); - ReferenceDefinition referenceDefinition = new ReferenceDefinition(refUri, null); - referenceDefinition.setRequired(true); - type.add(referenceDefinition); - impl.setComponentType(type); - - URI sourceUri = URI.create("source"); - ComponentDefinition definition = - new ComponentDefinition>>>(impl); - definition.setUri(sourceUri); - ReferenceTarget referenceTarget = new ReferenceTarget(); - referenceTarget.setReferenceName(refUri); - referenceTarget.addTarget(URI.create("NotThere")); - definition.add(referenceTarget); - Component component = EasyMock.createMock(Component.class); - EasyMock.expect(component.getUri()).andReturn(sourceUri); - EasyMock.replay(component); - manager.register(component); - try { - connector.connect(definition); - fail(); - } catch (ComponentNotFoundException e) { - // expected - } - } - - /** - * Verifies a non-existent target does not throw an error. - *

- * TODO JFM when the allocator is in place it should optimize connecting to non-existent targets but keep it for - * now - */ - public void testConnectTargetNotFoundNonRequiredReference() throws Exception { - Implementation>> impl = - new Implementation>>() { - }; - ComponentType> type = - new ComponentType>(); - URI refUri = URI.create("ref"); - ReferenceDefinition referenceDefinition = new ReferenceDefinition(refUri, null); - referenceDefinition.setRequired(false); - type.add(referenceDefinition); - impl.setComponentType(type); - - URI sourceUri = URI.create("source"); - ComponentDefinition definition = - new ComponentDefinition>>>(impl); - definition.setUri(sourceUri); - ReferenceTarget referenceTarget = new ReferenceTarget(); - referenceTarget.setReferenceName(refUri); - referenceTarget.addTarget(URI.create("NotThere")); - definition.add(referenceTarget); - Component component = EasyMock.createMock(Component.class); - EasyMock.expect(component.getUri()).andReturn(sourceUri); - EasyMock.replay(component); - manager.register(component); - connector.connect(definition); - } - - public void testNonOptimizableTargetComponent() throws Exception { - AtomicComponent source = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(source.getScope()).andReturn(Scope.COMPOSITE); - EasyMock.replay(source); - - AtomicComponent target = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(target.getScope()).andReturn(Scope.COMPOSITE); - EasyMock.expect(target.isOptimizable()).andReturn(false); - EasyMock.replay(target); - - Wire wire = EasyMock.createMock(Wire.class); - wire.setOptimizable(false); - EasyMock.replay(wire); - connector.optimize(source, target, wire); - EasyMock.verify(source); - EasyMock.verify(target); - EasyMock.verify(wire); - } - - public void testOptimizableTargetComponent() throws Exception { - AtomicComponent source = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(source.getScope()).andReturn(Scope.COMPOSITE); - EasyMock.replay(source); - - AtomicComponent target = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(target.getScope()).andReturn(Scope.COMPOSITE); - EasyMock.expect(target.isOptimizable()).andReturn(true); - EasyMock.replay(target); - - Wire wire = EasyMock.createMock(Wire.class); - wire.setOptimizable(true); - wire.setTarget(EasyMock.eq(target)); - wire.getInvocationChains(); - EasyMock.expectLastCall().andReturn(Collections.emptyMap()); - wire.getCallbackInvocationChains(); - EasyMock.expectLastCall().andReturn(Collections.emptyMap()); - EasyMock.replay(wire); - connector.optimize(source, target, wire); - EasyMock.verify(source); - EasyMock.verify(target); - } - - public void testIsOptimizable() { - assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.STATELESS)); - assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.STATELESS, Scope.CONVERSATION)); - assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.REQUEST)); - assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.SESSION)); - assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.SYSTEM)); - - assertTrue(connector.isOptimizable(Scope.COMPOSITE, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.CONVERSATION)); - assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.REQUEST)); - assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.STATELESS)); - assertTrue(connector.isOptimizable(Scope.COMPOSITE, Scope.SYSTEM)); - - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.CONVERSATION)); - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.REQUEST)); - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.STATELESS)); - assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.SYSTEM)); - - assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.REQUEST, Scope.CONVERSATION)); - assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.REQUEST)); - assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.REQUEST, Scope.STATELESS)); - assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.SYSTEM)); - - assertTrue(connector.isOptimizable(Scope.SESSION, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.SESSION, Scope.CONVERSATION)); - assertFalse(connector.isOptimizable(Scope.SESSION, Scope.REQUEST)); - assertTrue(connector.isOptimizable(Scope.SESSION, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.SESSION, Scope.STATELESS)); - assertTrue(connector.isOptimizable(Scope.SESSION, Scope.SYSTEM)); - - assertTrue(connector.isOptimizable(Scope.SYSTEM, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.CONVERSATION)); - assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.REQUEST)); - assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.STATELESS)); - assertTrue(connector.isOptimizable(Scope.SYSTEM, Scope.SYSTEM)); - - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.COMPOSITE)); - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.CONVERSATION)); - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.REQUEST)); - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.SESSION)); - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.STATELESS)); - assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.SYSTEM)); - - } - - public void testCreateSyncForwardWire() throws Exception { - ServiceContract contract = new ServiceContract() { - - }; - Operation operation = new Operation("operation", null, null, null); - Map> operations = new HashMap>(); - operations.put("operation", operation); - contract.setOperations(operations); - Wire wire = connector.createWire(URI.create("target"), URI.create("#ref"), contract, Wire.LOCAL_BINDING); - assertEquals(1, wire.getInvocationChains().size()); - InvocationChain chain = wire.getInvocationChains().get(operation); - Interceptor head = chain.getHeadInterceptor(); - assertTrue(head instanceof InvokerInterceptor); - } - - public void testCreateSyncCallbackWire() throws Exception { - ServiceContract contract = new ServiceContract() { - - }; - - Operation operation = new Operation("operation", null, null, null); - Map> operations = new HashMap>(); - operations.put("operation", operation); - contract.setOperations(operations); - - Operation callbackOperation = new Operation("operation", null, null, null); - Map> callbackOperations = new HashMap>(); - callbackOperations.put("operation", callbackOperation); - contract.setCallbackOperations(callbackOperations); - - Wire wire = connector.createWire(URI.create("target"), URI.create("#ref"), contract, Wire.LOCAL_BINDING); - assertEquals(1, wire.getCallbackInvocationChains().size()); - InvocationChain chain = wire.getCallbackInvocationChains().get(callbackOperation); - Interceptor head = chain.getHeadInterceptor(); - assertTrue(head instanceof InvokerInterceptor); - } - - public void testCreateNonBlockingForwardWire() throws Exception { - ServiceContract contract = new ServiceContract() { - - }; - Operation operation = new Operation("operation", null, null, null); - operation.setNonBlocking(true); - Map> operations = new HashMap>(); - operations.put("operation", operation); - contract.setOperations(operations); - Wire wire = connector.createWire(URI.create("target"), URI.create("#ref"), contract, Wire.LOCAL_BINDING); - assertEquals(1, wire.getInvocationChains().size()); - InvocationChain chain = wire.getInvocationChains().get(operation); - Interceptor head = chain.getHeadInterceptor(); - assertTrue(head instanceof NonBlockingInterceptor); - assertTrue(head.getNext() instanceof InvokerInterceptor); - } - - public void testCreateNonBlockingCallbackWire() throws Exception { - ServiceContract contract = new ServiceContract() { - - }; - - Operation operation = new Operation("operation", null, null, null); - operation.setNonBlocking(true); - Map> operations = new HashMap>(); - operations.put("operation", operation); - contract.setOperations(operations); - - Operation callbackOperation = new Operation("operation", null, null, null); - callbackOperation.setNonBlocking(true); - Map> callbackOperations = new HashMap>(); - callbackOperations.put("operation", callbackOperation); - contract.setCallbackOperations(callbackOperations); - - Wire wire = connector.createWire(URI.create("target"), URI.create("#ref"), contract, Wire.LOCAL_BINDING); - assertEquals(1, wire.getCallbackInvocationChains().size()); - InvocationChain chain = wire.getCallbackInvocationChains().get(callbackOperation); - Interceptor head = chain.getHeadInterceptor(); - assertTrue(head instanceof NonBlockingInterceptor); - assertTrue(head.getNext() instanceof InvokerInterceptor); - } - - protected void setUp() throws Exception { - super.setUp(); - manager = new ComponentManagerImpl(); - connector = new TestConnector(manager); - } - - private class TestConnector extends ConnectorImpl { - - public TestConnector(ComponentManager componentManager) { - super(componentManager); - } - - protected Wire createWire(URI sourceURI, URI targetUri, ServiceContract contract, QName bindingType) { - return super.createWire(sourceURI, targetUri, contract, bindingType); - } - - public boolean isOptimizable(Scope pReferrer, Scope pReferee) { - return super.isOptimizable(pReferrer, pReferee); - } - - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java deleted file mode 100644 index c6a9927db3..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class IllegalCallbackExceptionTestCase extends TestCase { - - public void testInstantiation() throws Exception { - URI sourceUri = URI.create("source"); - URI targetUri = URI.create("target"); - IllegalCallbackException e = new IllegalCallbackException("message", "identifier", sourceUri, targetUri); - assertEquals("message", e.getMessage()); - assertEquals("identifier", e.getIdentifier()); - assertEquals(sourceUri, e.getSourceUri()); - assertEquals(targetUri, e.getTargetUri()); - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java deleted file mode 100644 index 5d370fcfc5..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class IncompatibleInterfacesExceptionTestCase extends TestCase { - - public void testInstantiation() throws Exception { - URI sourceUri = URI.create("source"); - URI targetUri = URI.create("target"); - IncompatibleInterfacesException e = new IncompatibleInterfacesException(sourceUri, targetUri); - assertNotNull(e.getMessage()); - assertEquals("source", e.getSourceUri().toString()); - assertEquals("target", e.getTargetUri().toString()); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidSourceTypeExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidSourceTypeExceptionTestCase.java deleted file mode 100644 index 67ad003d58..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidSourceTypeExceptionTestCase.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class InvalidSourceTypeExceptionTestCase extends TestCase { - - public void testInstantiation() throws Exception { - URI sourceUri = URI.create("source"); - URI targetUri = URI.create("target"); - InvalidSourceTypeException e = new InvalidSourceTypeException("message", sourceUri, targetUri); - assertEquals("message", e.getMessage()); - assertEquals(sourceUri, e.getSourceUri()); - assertEquals(targetUri, e.getTargetUri()); - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java deleted file mode 100644 index 61060293ce..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class InvalidTargetTypeExceptionTestCase extends TestCase { - - public void testInstantiation() throws Exception { - URI sourceUri = URI.create("source"); - URI targetUri = URI.create("target"); - InvalidTargetTypeException e = new InvalidTargetTypeException("message", sourceUri, targetUri); - assertEquals("message", e.getMessage()); - assertEquals(sourceUri, e.getSourceUri()); - assertEquals(targetUri, e.getTargetUri()); - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java deleted file mode 100644 index 2d056ac964..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class TargetServiceNotFoundExceptionTestCase extends TestCase { - - public void testInstantiation() throws Exception { - URI sourceUri = URI.create("source"); - URI targetUri = URI.create("target"); - TargetServiceNotFoundException e = new TargetServiceNotFoundException("message", sourceUri, targetUri); - assertEquals("message", e.getMessage()); - assertEquals(sourceUri, e.getSourceUri()); - assertEquals(targetUri, e.getTargetUri()); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java deleted file mode 100644 index fcd5f03189..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.WirePostProcessor; -import org.apache.tuscany.spi.wire.WirePostProcessorRegistry; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.verify; - -/** - * @version $Rev$ $Date$ - */ -public class WirePostProcessorRegistryImplTestCase extends TestCase { - - public void testRegisterUnregister() throws Exception { - WirePostProcessorRegistry registry = new WirePostProcessorRegistryImpl(); - Wire wire = EasyMock.createMock(Wire.class); - WirePostProcessor processor = createMock(WirePostProcessor.class); - processor.process(EasyMock.eq(wire)); - EasyMock.replay(processor); - registry.register(processor); - registry.process(wire); - registry.unregister(processor); - registry.process(wire); - verify(processor); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java deleted file mode 100644 index e05a162d7a..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.builder; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.URI; - -import org.apache.tuscany.spi.builder.WiringException; - -import junit.framework.TestCase; -import org.apache.tuscany.host.monitor.FormatterRegistry; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WiringExceptionFormatterTestCase extends TestCase { - WiringExceptionFormatter formatter = new WiringExceptionFormatter(EasyMock.createNiceMock(FormatterRegistry.class)); - - public void testFormat() throws Exception { - WiringException e = - new MockWiringException("message", "identifier", URI.create("source"), URI.create("target")); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("identifier") >= 0); - assertTrue(buffer.indexOf("source") >= 0); - assertTrue(buffer.indexOf("target") >= 0); - } - - - public void testFormatNulls() throws Exception { - WiringException e = new MockWiringException("message", - "identifier", - null, - null); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("identifier") >= 0); - } - - private class MockWiringException extends WiringException { - - public MockWiringException(String message, String identifier, URI source, URI reference) { - super(message, identifier, source, reference); - } - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/ComponentManagerImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/ComponentManagerImplTestCase.java deleted file mode 100644 index c1710e9b8e..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/ComponentManagerImplTestCase.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.DuplicateNameException; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentManagerImplTestCase extends TestCase { - private static final URI DOMAIN = URI.create("sca://localhost/"); - private static final URI ROOT1 = DOMAIN.resolve("root1"); - private static final URI GRANDCHILD = DOMAIN.resolve("parent/child2/grandchild"); - - private ComponentManagerImpl manager; - - public void testRegister() throws Exception { - Component root = EasyMock.createMock(Component.class); - EasyMock.expect(root.getUri()).andReturn(ROOT1); - EasyMock.replay(root); - manager.register(root); - assertEquals(root, manager.getComponent(ROOT1)); - EasyMock.verify(root); - - EasyMock.reset(root); - EasyMock.expect(root.getUri()).andReturn(ROOT1); - EasyMock.replay(root); - manager.unregister(root); - EasyMock.verify(root); - assertEquals(null, manager.getComponent(ROOT1)); - } - - public void testRegisterGrandchild() throws Exception { - Component root = EasyMock.createMock(Component.class); - EasyMock.expect(root.getUri()).andReturn(GRANDCHILD); - EasyMock.replay(root); - manager.register(root); - assertEquals(root, manager.getComponent(GRANDCHILD)); - EasyMock.verify(root); - } - - public void testRegisterDuplicate() throws Exception { - Component root = EasyMock.createMock(Component.class); - EasyMock.expect(root.getUri()).andReturn(ROOT1); - EasyMock.replay(root); - - Component duplicate = EasyMock.createMock(Component.class); - EasyMock.expect(duplicate.getUri()).andReturn(ROOT1); - EasyMock.replay(duplicate); - - manager.register(root); - assertEquals(root, manager.getComponent(ROOT1)); - try { - manager.register(duplicate); - fail(); - } catch (DuplicateNameException e) { - // expected - } - assertEquals(root, manager.getComponent(ROOT1)); - EasyMock.verify(root); - EasyMock.verify(duplicate); - } - - protected void setUp() throws Exception { - super.setUp(); - manager = new ComponentManagerImpl(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/JavaObjectRegistrationTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/JavaObjectRegistrationTestCase.java deleted file mode 100644 index 2d00a13716..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/JavaObjectRegistrationTestCase.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.DuplicateNameException; -import org.apache.tuscany.spi.idl.java.JavaServiceContract; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class JavaObjectRegistrationTestCase extends TestCase { - private ComponentManager componentManager; - - public void testRegistration() throws Exception { - MockComponent instance = new MockComponent(); - URI uri = URI.create("foo"); - JavaServiceContract contract = new JavaServiceContract(MockComponent.class) { - }; - componentManager.registerJavaObject(uri, contract, instance); - Component component = componentManager.getComponent(URI.create("foo")); - assertTrue(component instanceof AtomicComponent); - MockComponent resolvedInstance = (MockComponent) ((AtomicComponent) component).getTargetInstance(); - assertSame(instance, resolvedInstance); - } - - public void testDuplicateRegistration() throws Exception { - MockComponent instance = new MockComponent(); - URI uri = URI.create("foo"); - JavaServiceContract contract = new JavaServiceContract(MockComponent.class) { - }; - componentManager.registerJavaObject(uri, contract, instance); - try { - componentManager.registerJavaObject(uri, contract, instance); - fail(); - } catch (DuplicateNameException e) { - // ok - } - } - - protected void setUp() throws Exception { - super.setUp(); - componentManager = new ComponentManagerImpl(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - private static class MockComponent { - public String hello(String message) { - return message; - } - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponentTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponentTestCase.java deleted file mode 100644 index fac45ebfb5..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/SystemSingletonAtomicComponentTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.spi.component.TargetException; -import org.apache.tuscany.spi.idl.java.JavaServiceContract; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class SystemSingletonAtomicComponentTestCase extends TestCase { - - public void testGetInstance() throws TargetException { - JavaServiceContract contract = new JavaServiceContract(Foo.class) { - - }; - FooImpl foo = new FooImpl(); - SystemSingletonAtomicComponent component = - new SystemSingletonAtomicComponent(URI.create("foo"), contract, foo); - assertEquals(foo, component.getTargetInstance()); - } - - public void testGetInstanceMultipleServices() throws TargetException { - FooImpl foo = new FooImpl(); - List> services = new ArrayList>(); - services.add(new JavaServiceContract(Foo.class) { - }); - services.add(new JavaServiceContract(Bar.class) { - }); - SystemSingletonAtomicComponent component = - new SystemSingletonAtomicComponent(URI.create("foo"), services, foo); - assertEquals(foo, component.getTargetInstance()); - } - - public void testOptimizable() { - JavaServiceContract contract = new JavaServiceContract(Foo.class) { - }; - FooImpl foo = new FooImpl(); - SystemSingletonAtomicComponent component = - new SystemSingletonAtomicComponent(URI.create("foo"), contract, foo); - assertTrue(component.isOptimizable()); - } - - - protected void setUp() throws Exception { - super.setUp(); - } - - private interface Foo { - - } - - private interface Bar { - - } - - private class FooImpl implements Foo, Bar { - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java deleted file mode 100644 index 93cb50ddcb..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.event; - -import java.net.URI; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class EventTestCase extends TestCase { - private URI uri = URI.create("foo"); - - public void testCompositeStart() { - ComponentStart event = new ComponentStart(this, uri); - assertEquals(uri, event.getComponentUri()); - } - - public void testCompositeStop() { - ComponentStop event = new ComponentStop(this, uri); - assertEquals(uri, event.getComponentUri()); - } - - public void testHttpSessionStart() { - Object id = new Object(); - HttpSessionEvent event = new HttpSessionStart(this, id); - assertEquals(this, event.getSource()); - assertEquals(id, event.getId()); - } - - public void testHttpSessionEnd() { - Object id = new Object(); - HttpSessionEvent event = new HttpSessionEnd(this, id); - assertEquals(this, event.getSource()); - assertEquals(id, event.getId()); - } - - public void testRequestStart() { - RequestStart event = new RequestStart(this); - assertEquals(this, event.getSource()); - } - - public void testReequestEnd() { - RequestEnd event = new RequestEnd(this); - assertEquals(this, event.getSource()); - } - - - protected void setUp() throws Exception { - super.setUp(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java deleted file mode 100644 index a6e4de3c48..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; - -import junit.framework.TestCase; - -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; - -import org.easymock.EasyMock; -import org.easymock.IMocksControl; - -/** - * @version $Rev$ $Date$ - */ -public abstract class AbstractScopeContainerTestCase extends TestCase { - protected IMocksControl control; - protected ScopeContainer scopeContainer; - protected URI groupId; - protected KEY contextId; - protected AtomicComponent component; - protected InstanceWrapper wrapper; - - @SuppressWarnings("unchecked") - protected void setUp() throws Exception { - super.setUp(); - control = EasyMock.createStrictControl(); - component = control.createMock(AtomicComponent.class); - wrapper = control.createMock(InstanceWrapper.class); - } - - protected void preRegisterComponent() throws Exception { - scopeContainer.start(); - scopeContainer.register(component, groupId); - EasyMock.expect(component.isEagerInit()).andStubReturn(false); - } - - protected void expectCreateWrapper() throws Exception { - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java deleted file mode 100644 index cb66af27b0..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import org.easymock.IMocksControl; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.model.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class BasicCompositeScopeTestCase extends TestCase { - protected IMocksControl control; - protected ScopeContainer scopeContainer; - protected URI groupId; - protected URI contextId; - protected AtomicComponent component; - protected InstanceWrapper wrapper; - - public void testCorrectScope() { - assertEquals(Scope.COMPOSITE, scopeContainer.getScope()); - } - - public void testWrapperCreation() throws Exception { - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - control.replay(); - scopeContainer.register(component, groupId); - assertSame(wrapper, scopeContainer.getWrapper(component, contextId)); - assertSame(wrapper, scopeContainer.getWrapper(component, contextId)); - assertSame(wrapper, scopeContainer.getAssociatedWrapper(component, contextId)); - control.verify(); - } - - public void testGetAssociatedInstanceNonExistent() throws Exception { - URI uri = URI.create("oops"); - EasyMock.expect(component.getUri()).andReturn(uri); - control.replay(); - scopeContainer.register(component, groupId); - try { - scopeContainer.getAssociatedWrapper(component, contextId); - fail(); - } catch (TargetResolutionException e) { - assertEquals(uri.toString(), e.getMessage()); - } - control.verify(); - } - - /* - public void testLifecycleWithNoEagerInit() throws Exception { - EasyMock.expect(component.getInitLevel()).andReturn(0); - control.replay(); - scopeContainer.startContext(contextId, groupId); - scopeContainer.stopContext(contextId); - control.verify(); - } - - public void testLifecycleWithEagerInit() throws Exception { - EasyMock.expect(component.getInitLevel()).andReturn(1); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - wrapper.stop(); - EasyMock.replay(component, wrapper); - scopeContainer.onEvent(new ComponentStart(this, null)); - scopeContainer.onEvent(new ComponentStop(this, null)); - EasyMock.verify(component, wrapper); - } - - public void testDestroyOrder() throws Exception { - scopeContainer = new CompositeScopeContainer(null); - scopeContainer.start(); - IMocksControl control = EasyMock.createStrictControl(); - InstanceWrapper wrapper1 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper3 = control.createMock(InstanceWrapper.class); - AtomicComponent component1 = control.createMock(AtomicComponent.class); - AtomicComponent component2 = control.createMock(AtomicComponent.class); - AtomicComponent component3 = control.createMock(AtomicComponent.class); - - EasyMock.expect(component1.getInitLevel()).andStubReturn(-1); - EasyMock.expect(component2.getInitLevel()).andStubReturn(1); - EasyMock.expect(component3.getInitLevel()).andStubReturn(-1); - - EasyMock.expect(component2.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper1); - wrapper1.start(); - EasyMock.expect(component3.createInstanceWrapper()).andReturn(wrapper3); - wrapper3.start(); - wrapper3.stop(); - wrapper1.stop(); - wrapper2.stop(); - control.replay(); - - scopeContainer.register(component1, contextId); - scopeContainer.register(component2, contextId); - scopeContainer.register(component3, contextId); - scopeContainer.onEvent(new ComponentStart(this, null)); - assertSame(wrapper1, scopeContainer.getWrapper(component1)); - assertSame(wrapper2, scopeContainer.getWrapper(component2)); - assertSame(wrapper3, scopeContainer.getWrapper(component3)); - scopeContainer.onEvent(new ComponentStop(this, null)); - control.verify(); - } - */ - @SuppressWarnings("unchecked") - protected void setUp() throws Exception { - super.setUp(); - groupId = contextId = URI.create("compositeId"); - control = EasyMock.createStrictControl(); - component = control.createMock(AtomicComponent.class); - EasyMock.expect(component.isEagerInit()).andStubReturn(false); - wrapper = control.createMock(InstanceWrapper.class); - - scopeContainer = new CompositeScopeContainer(null); - scopeContainer.start(); - scopeContainer.startContext(contextId, groupId); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java deleted file mode 100644 index 02f5540dea..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.core.services.store.memory.MemoryStore; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.services.store.StoreMonitor; -import org.easymock.EasyMock; - -/** - * @version $$Rev: 471111 $$ $$Date: 2006-11-03 23:06:48 -0500 (Fri, 03 Nov 2006) $$ - */ -public class BasicConversationalScopeTestCase extends TestCase { - private AtomicComponent component; - private InstanceWrapper wrapper; - private ScopeContainer scopeContainer; - private WorkContext workContext; - -/* - public void testLifecycleManagement() throws Exception { - // start the request - String conversation = "conv"; - workContext.setIdentifier(Scope.CONVERSATION, conversation); - - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - // FIXME shouldn't stop be called when the component is removed? -// wrapper.stop(); - EasyMock.replay(component, wrapper); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getWrapper(component)); - scopeContainer.remove(component); - EasyMock.verify(component, wrapper); - } -*/ - -/* - public void testCoversationIsolation() throws Exception { - String conversation1 = "conv"; - String conversation2 = "conv2"; - - InstanceWrapper wrapper2 = EasyMock.createStrictMock(InstanceWrapper.class); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - EasyMock.replay(component, wrapper, wrapper2); - workContext.setIdentifier(Scope.CONVERSATION, conversation1); - assertSame(wrapper, scopeContainer.getWrapper(component)); - workContext.setIdentifier(Scope.CONVERSATION, conversation2); - assertSame(wrapper2, scopeContainer.getWrapper(component)); - EasyMock.verify(component, wrapper); - } -*/ - public void testX() { -} - - protected void setUp() throws Exception { - super.setUp(); - component = EasyMock.createStrictMock(AtomicComponent.class); - EasyMock.expect(component.getMaxAge()).andStubReturn(-1); - EasyMock.expect(component.getMaxIdleTime()).andStubReturn(-1); - wrapper = EasyMock.createStrictMock(InstanceWrapper.class); - - StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class); - monitor.start(EasyMock.isA(String.class)); - monitor.stop(EasyMock.isA(String.class)); - MemoryStore store = new MemoryStore(monitor); - workContext = new SimpleWorkContext(); - scopeContainer = new ConversationalScopeContainer(store, workContext, null); - scopeContainer.start(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java deleted file mode 100644 index 1f29c92c92..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.WorkContext; -import org.easymock.EasyMock; - -/** - * @version $$Rev$$ $$Date$$ - */ -public abstract class BasicHttpSessionScopeTestCase extends TestCase { - private ScopeContainerMonitor monitor; - private ScopeContainer scopeContainer; - private AtomicComponent component; - private InstanceWrapper wrapper; - private WorkContext workContext; - - public void testLifecycleManagement() throws Exception { -/* - // start the request - Object session = new Object(); - workContext.setIdentifier(Scope.SESSION, session); - - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - wrapper.stop(); - EasyMock.replay(component, wrapper); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getWrapper(component)); - scopeContainer.onEvent(new HttpSessionEnd(this, session)); - EasyMock.verify(component, wrapper); -*/ - } - - public void testGetAssociatedInstance() throws Exception { -/* - // start the request - Object session = new Object(); - workContext.setIdentifier(Scope.SESSION, session); - - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.replay(component, wrapper); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getAssociatedWrapper(component)); - EasyMock.verify(component, wrapper); -*/ - } - - public void testGetAssociatedInstanceNonExistent() throws Exception { -/* - URI id = URI.create("oops"); - EasyMock.expect(component.getUri()).andReturn(id); - EasyMock.replay(component); - - // start the request - Object session = new Object(); - workContext.setIdentifier(Scope.SESSION, session); - try { - scopeContainer.getAssociatedWrapper(component); - fail(); - } catch (TargetNotFoundException e) { - assertEquals(id.toString(), e.getMessage()); - EasyMock.verify(component); - } -*/ - } - - public void testSessionIsolation() throws Exception { -/* - // start the request - Object session1 = new Object(); - Object session2 = new Object(); - - InstanceWrapper wrapper2 = EasyMock.createNiceMock(InstanceWrapper.class); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - EasyMock.replay(component, wrapper); - workContext.setIdentifier(Scope.SESSION, session1); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getAssociatedWrapper(component)); - workContext.setIdentifier(Scope.SESSION, session2); - assertSame(wrapper2, scopeContainer.getWrapper(component)); - assertSame(wrapper2, scopeContainer.getAssociatedWrapper(component)); - workContext.setIdentifier(Scope.SESSION, session1); - assertSame(wrapper, scopeContainer.getWrapper(component)); - EasyMock.verify(component, wrapper); -*/ - } - - public void testDestroyErrorMonitor() throws Exception { -/* - TargetDestructionException ex = new TargetDestructionException("oops", "again"); - monitor.destructionError(ex); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - wrapper.stop(); - EasyMock.expectLastCall().andThrow(ex); - EasyMock.replay(component, wrapper, monitor); - - Object id = new Object(); - scopeContainer.onEvent(new HttpSessionStart(this, id)); - workContext.setIdentifier(Scope.SESSION, id); - assertSame(wrapper, scopeContainer.getWrapper(component)); - scopeContainer.onEvent(new HttpSessionEnd(this, id)); - EasyMock.verify(component, wrapper, monitor); -*/ - } - - public void testDestroyOrder() throws Exception { -/* - Object session = new Object(); - workContext.setIdentifier(Scope.SESSION, session); - - IMocksControl control = EasyMock.createStrictControl(); - InstanceWrapper wrapper1 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper3 = control.createMock(InstanceWrapper.class); - AtomicComponent component1 = control.createMock(AtomicComponent.class); - AtomicComponent component2 = control.createMock(AtomicComponent.class); - AtomicComponent component3 = control.createMock(AtomicComponent.class); - - component1.addListener(scopeContainer); - component2.addListener(scopeContainer); - component3.addListener(scopeContainer); - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper1); - wrapper1.start(); - EasyMock.expect(component2.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - EasyMock.expect(component3.createInstanceWrapper()).andReturn(wrapper3); - wrapper3.start(); - wrapper3.stop(); - wrapper2.stop(); - wrapper1.stop(); - control.replay(); - - scopeContainer.register(component1, null); - scopeContainer.register(component2, null); - scopeContainer.register(component3, null); - scopeContainer.onEvent(new HttpSessionStart(this, session)); - assertSame(wrapper1, scopeContainer.getWrapper(component1)); - assertSame(wrapper2, scopeContainer.getWrapper(component2)); - assertSame(wrapper3, scopeContainer.getWrapper(component3)); - scopeContainer.onEvent(new HttpSessionEnd(this, session)); - control.verify(); -*/ - } - - public void testReuseSession() throws Exception { -/* - Object session = new Object(); - workContext.setIdentifier(Scope.SESSION, session); - - IMocksControl control = EasyMock.createStrictControl(); - InstanceWrapper wrapper1 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - AtomicComponent component1 = control.createMock(AtomicComponent.class); - - component1.addListener(scopeContainer); - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper1); - wrapper1.start(); - wrapper1.stop(); - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - wrapper2.stop(); - control.replay(); - - scopeContainer.register(component1, null); - scopeContainer.onEvent(new HttpSessionStart(this, session)); - assertSame(wrapper1, scopeContainer.getWrapper(component1)); - scopeContainer.onEvent(new HttpSessionEnd(this, session)); - - scopeContainer.onEvent(new HttpSessionStart(this, session)); - assertSame(wrapper2, scopeContainer.getWrapper(component1)); - scopeContainer.onEvent(new HttpSessionEnd(this, session)); - control.verify(); -*/ - } - - protected void setUp() throws Exception { - super.setUp(); - component = EasyMock.createStrictMock(AtomicComponent.class); - wrapper = EasyMock.createStrictMock(InstanceWrapper.class); - - workContext = new SimpleWorkContext(); - monitor = EasyMock.createStrictMock(ScopeContainerMonitor.class); - scopeContainer = new HttpSessionScopeContainer(workContext, monitor); - scopeContainer.start(); - - component.addListener(scopeContainer); - EasyMock.replay(component); - scopeContainer.register(component, null); - EasyMock.reset(component); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java deleted file mode 100644 index 4aad2dc0c6..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; - -/** - * @version $$Rev$$ $$Date$$ - */ -public abstract class BasicRequestScopeTestCase extends TestCase { - private ScopeContainerMonitor monitor; - private ScopeContainer scopeContainer; - private AtomicComponent component; - private InstanceWrapper wrapper; - - public void testLifecycleManagement() throws Exception { -/* - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.replay(component, wrapper); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getWrapper(component)); - EasyMock.verify(component, wrapper); -*/ - } - - public void testGetAssociatedInstance() throws Exception { -/* - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.replay(component, wrapper); - assertSame(wrapper, scopeContainer.getWrapper(component)); - assertSame(wrapper, scopeContainer.getAssociatedWrapper(component)); - EasyMock.verify(component, wrapper); -*/ - } - - public void testGetAssociatedInstanceNonExistent() throws Exception { -/* - URI id = URI.create("oops"); - EasyMock.expect(component.getUri()).andReturn(id); - EasyMock.replay(component); - - try { - scopeContainer.getAssociatedWrapper(component); - fail(); - } catch (TargetNotFoundException e) { - assertEquals(id.toString(), e.getMessage()); - EasyMock.verify(component); - } -*/ - } - - public void testRequestIsolation() throws Exception { -/* - IMocksControl control = EasyMock.createStrictControl(); - InstanceWrapper wrapper1 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - AtomicComponent component1 = control.createMock(AtomicComponent.class); - AtomicComponent component2 = control.createMock(AtomicComponent.class); - - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper1); - wrapper1.start(); - wrapper1.stop(); - EasyMock.expect(component2.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - wrapper2.stop(); - control.replay(); - - scopeContainer.register(component1, null); - scopeContainer.register(component2, null); - scopeContainer.onEvent(new RequestStart(this)); - assertSame(wrapper1, scopeContainer.getWrapper(component1)); - scopeContainer.onEvent(new RequestEnd(this)); - scopeContainer.onEvent(new RequestStart(this)); - assertSame(wrapper2, scopeContainer.getWrapper(component2)); - scopeContainer.onEvent(new RequestEnd(this)); - control.verify(); -*/ - } - - public void testDestroyErrorMonitor() throws Exception { -/* - TargetDestructionException ex = new TargetDestructionException("oops", "again"); - monitor.destructionError(ex); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - wrapper.stop(); - EasyMock.expectLastCall().andThrow(ex); - EasyMock.replay(component, wrapper, monitor); - - scopeContainer.onEvent(new RequestStart(this)); - assertSame(wrapper, scopeContainer.getWrapper(component)); - scopeContainer.onEvent(new RequestEnd(this)); - EasyMock.verify(component, wrapper, monitor); -*/ - } - - public void testDestroyOrder() throws Exception { -/* - IMocksControl control = EasyMock.createStrictControl(); - InstanceWrapper wrapper1 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - InstanceWrapper wrapper3 = control.createMock(InstanceWrapper.class); - AtomicComponent component1 = control.createMock(AtomicComponent.class); - AtomicComponent component2 = control.createMock(AtomicComponent.class); - AtomicComponent component3 = control.createMock(AtomicComponent.class); - - EasyMock.expect(component1.createInstanceWrapper()).andReturn(wrapper1); - wrapper1.start(); - EasyMock.expect(component2.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - EasyMock.expect(component3.createInstanceWrapper()).andReturn(wrapper3); - wrapper3.start(); - wrapper3.stop(); - wrapper2.stop(); - wrapper1.stop(); - control.replay(); - - scopeContainer.register(component1, null); - scopeContainer.register(component2, null); - scopeContainer.register(component3, null); - scopeContainer.onEvent(new RequestStart(this)); - assertSame(wrapper1, scopeContainer.getWrapper(component1)); - assertSame(wrapper2, scopeContainer.getWrapper(component2)); - assertSame(wrapper3, scopeContainer.getWrapper(component3)); - scopeContainer.onEvent(new RequestEnd(this)); - control.verify(); -*/ - } - - protected void setUp() throws Exception { - super.setUp(); - component = EasyMock.createStrictMock(AtomicComponent.class); - wrapper = EasyMock.createStrictMock(InstanceWrapper.class); - monitor = EasyMock.createStrictMock(ScopeContainerMonitor.class); - scopeContainer = new RequestScopeContainer(monitor); - scopeContainer.start(); - - component.addListener(scopeContainer); - EasyMock.replay(component); - scopeContainer.register(component, null); - EasyMock.reset(component); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java deleted file mode 100644 index a7cab71ade..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import org.easymock.IMocksControl; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.model.Scope; - -/** - * Unit tests for the composite scope container - * - * @version $Rev$ $Date$ - */ -public class BasicStatelessScopeTestCase extends TestCase { - private StatelessScopeContainer scopeContainer; - private String contextId; - private IMocksControl control; - private AtomicComponent component; - private InstanceWrapper wrapper; - - public void testCorrectScope() { - assertEquals(Scope.STATELESS, scopeContainer.getScope()); - } - - public void testInstanceCreation() throws Exception { - @SuppressWarnings("unchecked") - InstanceWrapper wrapper2 = control.createMock(InstanceWrapper.class); - - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - wrapper.start(); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper2); - wrapper2.start(); - control.replay(); - - assertSame(wrapper, scopeContainer.getWrapper(component, contextId)); - assertSame(wrapper2, scopeContainer.getWrapper(component, contextId)); - control.verify(); - } - - public void testGetAssociatedInstance() throws Exception { - control.replay(); - try { - // always throws an exception, which is the semantic for stateless implementations - scopeContainer.getAssociatedWrapper(component, contextId); - fail(); - } catch (UnsupportedOperationException e) { - // ok - } - control.verify(); - } - - public void testReturnWrapper() throws Exception { - wrapper.stop(); - control.replay(); - scopeContainer.returnWrapper(component, wrapper, contextId); - control.verify(); - } - - @SuppressWarnings("unchecked") - protected void setUp() throws Exception { - super.setUp(); - scopeContainer = new StatelessScopeContainer(null); - contextId = "context"; - - control = EasyMock.createStrictControl(); - component = control.createMock(AtomicComponent.class); - wrapper = control.createMock(InstanceWrapper.class); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java deleted file mode 100644 index 01c426e917..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import java.net.URI; - -import org.apache.tuscany.spi.ObjectCreationException; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.TargetDestructionException; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.GroupInitializationException; - -import junit.framework.TestCase; -import org.apache.tuscany.core.component.event.ComponentStart; -import org.apache.tuscany.core.component.event.ComponentStop; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class CompositeScopeInitDestroyErrorTestCase extends TestCase { - private URI groupId; - - public void testInitializeError() throws Exception { - CompositeScopeContainer scope = new CompositeScopeContainer(null); - scope.start(); - - ObjectCreationException ex = new ObjectCreationException(""); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.createInstanceWrapper()).andThrow(ex); - EasyMock.expect(component.isEagerInit()).andStubReturn(true); - EasyMock.expect(component.getInitLevel()).andStubReturn(1); - EasyMock.replay(component); - scope.register(component, groupId); - try { - scope.startContext(groupId, groupId); - } catch (GroupInitializationException e) { - assertSame(ex, e.getCauses().get(0)); - } - EasyMock.verify(component); - } - - public void testDestroyErrorMonitor() throws Exception { - InstanceWrapper wrapper = EasyMock.createMock(InstanceWrapper.class); - wrapper.start(); - wrapper.stop(); - EasyMock.expectLastCall().andThrow(new TargetDestructionException("", "")); - EasyMock.replay(wrapper); - - ScopeContainerMonitor monitor; - monitor = EasyMock.createMock(ScopeContainerMonitor.class); - monitor.destructionError(EasyMock.isA(TargetDestructionException.class)); - EasyMock.replay(monitor); - CompositeScopeContainer scope = new CompositeScopeContainer(monitor); - scope.start(); - - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - EasyMock.expect(component.isEagerInit()).andStubReturn(true); - EasyMock.expect(component.getInitLevel()).andStubReturn(1); - EasyMock.replay(component); - scope.register(component, groupId); - scope.startContext(groupId, groupId); - scope.stopContext(groupId); - EasyMock.verify(monitor); - EasyMock.verify(component); - EasyMock.verify(wrapper); - } - - - protected void setUp() throws Exception { - super.setUp(); - groupId = URI.create("composite"); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java deleted file mode 100644 index caf0c0cc5e..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.services.store.Store; -import org.apache.tuscany.spi.services.store.StoreExpirationEvent; -import org.easymock.EasyMock; -import org.easymock.IAnswer; - -/** - * @version $Rev$ $Date$ - */ -public class ConversationalScopeContainerDestroyOnExpirationTestCase extends TestCase { - private Store store; - private RuntimeEventListener listener; - private WorkContext context; - private InstanceWrapper wrapper; - private AtomicComponent component; - - /** - * Verifies the scope container registers a callback listener for component instance destroy events when a - * conversational instance expires - */ - public void testDestroyNotification() throws Exception { - store.addListener(EasyMock.isA(RuntimeEventListener.class)); - EasyMock.expectLastCall().andStubAnswer(new IAnswer(){ - public Object answer() throws Throwable { - listener = (RuntimeEventListener) EasyMock.getCurrentArguments()[0]; - return null; - } - }); - wrapper.stop(); - EasyMock.replay(store); - EasyMock.replay(wrapper); - - new ConversationalScopeContainer(store, context, null); - listener.onEvent(new StoreExpirationEvent(this, component, wrapper)); - EasyMock.verify(store); - EasyMock.verify(wrapper); - } - - protected void setUp() throws Exception { - super.setUp(); - store = EasyMock.createMock(Store.class); - wrapper = EasyMock.createMock(InstanceWrapper.class); - component = EasyMock.createMock(AtomicComponent.class); - context = new SimpleWorkContext(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java deleted file mode 100644 index e896b410d0..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.store.Store; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ConversationalScopeContainerMaxAgeTestCase extends TestCase { - - private ScopeContainer container; - private WorkContext context; - private Store store; - private AtomicComponent component; - private InstanceWrapper wrapper; - - public void testMaxAgeUpdate() throws Exception { -/* - context.setIdentifier(Scope.CONVERSATION, "12345"); - assertSame(wrapper, container.getWrapper(component)); - EasyMock.verify(store); -*/ - } - - protected void setUp() throws Exception { - super.setUp(); - context = new SimpleWorkContext(); - component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce(); - EasyMock.replay(component); - - wrapper = EasyMock.createMock(InstanceWrapper.class); - - store = EasyMock.createMock(Store.class); - EasyMock.expect(store.readRecord(EasyMock.isA(SCAObject.class), EasyMock.isA(String.class))).andReturn(wrapper); - store.addListener(EasyMock.isA(RuntimeEventListener.class)); - EasyMock.replay(store); - container = new ConversationalScopeContainer(store, context, null); - container.start(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - context.clearIdentifier(Scope.CONVERSATION); - container.stop(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java deleted file mode 100644 index 9ac97bff32..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.InstanceWrapper; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.store.Store; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ConversationalScopeContainerMaxIdleTimeTestCase extends TestCase { - - private ScopeContainer container; - private WorkContext context; - private Store store; - private AtomicComponent component; - private InstanceWrapper wrapper; - - public void testMaxIdleTimeUpdate() throws Exception { -/* - context.setIdentifier(Scope.CONVERSATION, "12345"); - assertSame(wrapper, container.getWrapper(component)); - EasyMock.verify(store); -*/ - } - - protected void setUp() throws Exception { - super.setUp(); - wrapper = EasyMock.createMock(InstanceWrapper.class); - context = new SimpleWorkContext(); - component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getMaxIdleTime()).andStubReturn(600000L); - EasyMock.replay(component); - store = EasyMock.createMock(Store.class); - EasyMock.expect(store.readRecord(EasyMock.isA(SCAObject.class), EasyMock.isA(String.class))).andReturn(wrapper); - store.addListener(EasyMock.isA(RuntimeEventListener.class)); - store.updateRecord(EasyMock.isA(SCAObject.class), - EasyMock.isA(String.class), - EasyMock.eq(wrapper), - EasyMock.anyLong()); - EasyMock.replay(store); - container = new ConversationalScopeContainer(store, context, null); - container.start(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - context.clearIdentifier(Scope.CONVERSATION); - container.stop(); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java deleted file mode 100644 index a8960c4575..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.core.services.store.memory.MemoryStore; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.store.Store; -import org.apache.tuscany.spi.services.store.StoreMonitor; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public abstract class ConversationalScopeContainerPersistenceTestCase extends TestCase { - private ConversationalScopeContainer container; - private WorkContext context; - - public void testNotYetPersistedInMemory() throws Exception { -/* - InstanceWrapper wrapper = EasyMock.createMock(InstanceWrapper.class); - wrapper.start(); - EasyMock.replay(wrapper); - - String id = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - component.addListener(EasyMock.eq(container)); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce(); - EasyMock.replay(component); - - container.register(component, null); - assertSame(wrapper, container.getWrapper(component)); - EasyMock.verify(component); - EasyMock.verify(wrapper); -*/ - } - - public void testPersistNewInMemory() throws Exception { -/* - String id = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - component.addListener(EasyMock.eq(container)); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - EasyMock.replay(component); - container.register(component, null); - InstanceWrapper fooWrapper = EasyMock.createMock(InstanceWrapper.class); - InstanceWrapper fooWrapper2 = EasyMock.createMock(InstanceWrapper.class); - container.persistNew(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getWrapper(component)); - container.persistNew(component, id2, fooWrapper2, System.currentTimeMillis() + 100000); - context.setIdentifier(Scope.CONVERSATION, id2); - assertEquals(fooWrapper2, container.getWrapper(component)); - EasyMock.verify(component); -*/ - } - - public void testPersistInMemory() throws Exception { -/* - String id = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - component.addListener(EasyMock.eq(container)); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - EasyMock.replay(component); - container.register(component, null); - InstanceWrapper fooWrapper = EasyMock.createMock(InstanceWrapper.class); - container.persistNew(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getWrapper(component)); - container.persist(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getWrapper(component)); - EasyMock.verify(component); -*/ - } - - public void testRemoveInMemory() throws Exception { -/* - String id = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - component.addListener(EasyMock.eq(container)); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - EasyMock.expect(component.getUri()).andReturn(URI.create("foo")).atLeastOnce(); - EasyMock.replay(component); - container.register(component, null); - InstanceWrapper fooWrapper = EasyMock.createMock(InstanceWrapper.class); - container.persistNew(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getWrapper(component)); - container.remove(component); - try { - container.getAssociatedWrapper(component); - fail(); - } catch (TargetNotFoundException e) { - //expected - } - EasyMock.verify(component); -*/ - } - - public void testRecreateAfterRemoveInMemory() throws Exception { -/* - InstanceWrapper wrapper = EasyMock.createMock(InstanceWrapper.class); - wrapper.start(); - EasyMock.replay(wrapper); - - String id = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - component.addListener(EasyMock.eq(container)); - EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce(); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - EasyMock.expect(component.createInstanceWrapper()).andReturn(wrapper); - EasyMock.replay(component); - - container.register(component, null); - InstanceWrapper fooWrapper = EasyMock.createMock(InstanceWrapper.class); - container.persistNew(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getWrapper(component)); - container.remove(component); - assertSame(wrapper, container.getWrapper(component)); - EasyMock.verify(component); -*/ - } - - public void testGetPersistedInstance() throws Exception { -/* - String id = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - context.setIdentifier(Scope.CONVERSATION, id); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getUri()).andReturn(URI.create("foo")).atLeastOnce(); - EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce(); - component.addListener(EasyMock.eq(container)); - EasyMock.replay(component); - container.register(component, null); - - InstanceWrapper fooWrapper = EasyMock.createMock(InstanceWrapper.class); - container.persistNew(component, id, fooWrapper, System.currentTimeMillis() + 100000); - assertEquals(fooWrapper, container.getAssociatedWrapper(component)); - assertEquals(fooWrapper, container.getAssociatedWrapper(component)); - context.setIdentifier(Scope.CONVERSATION, id2); - try { - container.getAssociatedWrapper(component); - fail(); - } catch (TargetNotFoundException e) { - //expected - } - EasyMock.verify(component); -*/ - } - - protected void setUp() throws Exception { - super.setUp(); - context = new SimpleWorkContext(); - StoreMonitor mock = EasyMock.createNiceMock(StoreMonitor.class); - EasyMock.replay(mock); - Store store = new MemoryStore(mock); - container = new ConversationalScopeContainer(store, context, null); - container.start(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - context.clearIdentifier(Scope.CONVERSATION); - container.stop(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperBaseTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperBaseTestCase.java deleted file mode 100644 index c583ff19c6..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperBaseTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class InstanceWrapperBaseTestCase extends TestCase { - private static final Object INSTANCE = new Object(); - private InstanceWrapperBase wrapper; - - public void testLifecycle() throws Exception { - assertFalse(wrapper.isStarted()); - try { - wrapper.getInstance(); - fail(); - } catch (AssertionError e) { - // expected - } - wrapper.start(); - assertTrue(wrapper.isStarted()); - assertSame(INSTANCE, wrapper.getInstance()); - wrapper.stop(); - assertFalse(wrapper.isStarted()); - try { - wrapper.getInstance(); - fail(); - } catch (AssertionError e) { - // expected - } - } - - public void testNullCheck() { - try { - new InstanceWrapperBase(null); - fail(); - } catch (AssertionError e) { - // expected - } - } - - protected void setUp() throws Exception { - super.setUp(); - wrapper = new InstanceWrapperBase(INSTANCE); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java deleted file mode 100644 index 94feca05be..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.component.scope; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.WorkContext; - -import junit.framework.TestCase; -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WorkContextTestCase extends TestCase { - - public void testSetCurrentAtomicComponent() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - AtomicComponent component2 = EasyMock.createNiceMock(AtomicComponent.class); - ctx.setCurrentAtomicComponent(component); - assertEquals(component, ctx.getCurrentAtomicComponent()); - ctx.setCurrentAtomicComponent(component2); - assertEquals(component2, ctx.getCurrentAtomicComponent()); - } - - public void testNonSetCurrentAtomicComponent() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - assertNull(ctx.getCurrentAtomicComponent()); - } - - public void testIndentifier() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - Object id = new Object(); - ctx.setIdentifier(this, id); - assertEquals(id, ctx.getIdentifier(this)); - } - - public void testClearIndentifier() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - Object id = new Object(); - ctx.setIdentifier(this, id); - ctx.clearIdentifier(this); - assertNull(ctx.getIdentifier(this)); - } - - public void testClearIndentifiers() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - Object id = new Object(); - Object id2 = new Object(); - ctx.setIdentifier(id, id); - ctx.setIdentifier(id2, id2); - ctx.clearIdentifiers(); - assertNull(ctx.getIdentifier(id)); - assertNull(ctx.getIdentifier(id2)); - } - - public void testClearNonExistentIndentifier() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - ctx.clearIdentifier(this); - } - - public void testNullIndentifier() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - Object id = new Object(); - ctx.setIdentifier(this, id); - ctx.clearIdentifier(null); - assertEquals(id, ctx.getIdentifier(this)); - } - - public void testNoIndentifier() throws Exception { - WorkContext ctx = new SimpleWorkContext(); - assertNull(ctx.getIdentifier(this)); - } - - public void testSetGetCorrelationId() { - WorkContext context = new SimpleWorkContext(); - context.setCorrelationId("msg-005"); - assertEquals(context.getCorrelationId(), "msg-005"); - context.setCorrelationId(null); - assertNull(context.getCorrelationId()); - } - - public void testSetGetCorrelationIdInNewThread() throws InterruptedException { - WorkContext context = new SimpleWorkContext(); - context.setCorrelationId("msg-005"); - assertEquals(context.getCorrelationId(), "msg-005"); - context.setIdentifier("TX", "002"); - ChildThread t = new ChildThread(context); - t.start(); - t.join(); - assertTrue(t.passed); - context.setCorrelationId(null); - assertNull(context.getCorrelationId()); - } - - public void testCurrentAtomicComponentDoesNotPropagateToChildThread() throws InterruptedException { - // NOTE should behaviour be to propagate? - WorkContext context = new SimpleWorkContext(); - context.setCurrentAtomicComponent(EasyMock.createNiceMock(AtomicComponent.class)); - TestCurrentAtomicComponentChildThread t = new TestCurrentAtomicComponentChildThread(context); - t.start(); - t.join(); - assertTrue(t.passed); - context.setCurrentAtomicComponent(null); - assertNull(context.getCurrentAtomicComponent()); - } - - private static final class ChildThread extends Thread { - private WorkContext context; - private boolean passed = true; - - private ChildThread(WorkContext context) { - this.context = context; - } - - @Override - public void run() { - try { - assertNull(context.getCorrelationId()); - assertEquals("002", context.getIdentifier("TX")); - } catch (AssertionError e) { - passed = false; - } - } - - } - - private static final class TestCurrentAtomicComponentChildThread extends Thread { - private WorkContext context; - private boolean passed = true; - - private TestCurrentAtomicComponentChildThread(WorkContext context) { - this.context = context; - } - - @Override - public void run() { - try { - assertNull(context.getCurrentAtomicComponent()); - } catch (AssertionError e) { - passed = false; - } - } - - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java deleted file mode 100644 index a5574c7f78..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.model.Scope; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.easymock.EasyMock; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; - -/** - * @version $Rev$ $Date$ - */ -public class CompositeComponentImplTestCase extends TestCase { - - public void testGetScope() { - Component composite = new CompositeComponentImpl(URI.create("parent")); - Assert.assertEquals(Scope.SYSTEM, composite.getScope()); - } - - public void testRegisterService() throws Exception { - Component composite = new CompositeComponentImpl(URI.create("parent")); - Service service = new ServiceImpl(URI.create("foo#service"), null); - composite.register(service); - assertNotNull(composite.getService("service")); - } - - public void testRegisterReference() throws Exception { - Component composite = new CompositeComponentImpl(URI.create("parent")); - Reference reference = new ReferenceImpl(URI.create("foo#reference"), null); - composite.register(reference); - assertNotNull(composite.getReference("reference")); - } - - public void testOnEvent() { - CompositeComponentImpl composite = new CompositeComponentImpl(URI.create("parent")); - Event event = new Event() { - public Object getSource() { - return null; - } - }; - RuntimeEventListener listener = createMock(RuntimeEventListener.class); - listener.onEvent(eq(event)); - expectLastCall(); - replay(listener); - composite.addListener(listener); - composite.start(); - composite.onEvent(event); - EasyMock.verify(listener); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java deleted file mode 100644 index c3394c1043..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.component.DuplicateNameException; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.Component; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * Verfies children with the same name cannot be registered in the same composite - * - * @version $Rev$ $Date$ - */ -public class DuplicateRegistrationTestCase extends TestCase { - - public void testDuplicateServiceRegistration() throws Exception { - Component parent = new CompositeComponentImpl(URI.create("parent")); - parent.start(); - - Service service1 = EasyMock.createMock(Service.class); - EasyMock.expect(service1.getUri()).andReturn(URI.create("#service")).atLeastOnce(); - service1.stop(); - EasyMock.replay(service1); - - Service service2 = EasyMock.createMock(Service.class); - EasyMock.expect(service2.getUri()).andReturn(URI.create("#service")).atLeastOnce(); - service2.stop(); - EasyMock.replay(service2); - - parent.register(service2); - try { - parent.register(service1); - fail(); - } catch (DuplicateNameException e) { - // ok - } - parent.stop(); - } - - public void testDuplicateReferenceRegistration() throws Exception { - Component parent = new CompositeComponentImpl(URI.create("parent")); - parent.start(); - - Reference reference1 = EasyMock.createMock(Reference.class); - EasyMock.expect(reference1.getUri()).andReturn(URI.create("#reference")).atLeastOnce(); - reference1.stop(); - EasyMock.replay(reference1); - - Reference reference2 = EasyMock.createMock(Reference.class); - EasyMock.expect(reference2.getUri()).andReturn(URI.create("#reference")).atLeastOnce(); - reference2.stop(); - EasyMock.replay(reference2); - - parent.register(reference2); - try { - parent.register(reference1); - fail(); - } catch (DuplicateNameException e) { - // ok - } - parent.stop(); - - } - - public void testDuplicateServiceReferenceRegistration() throws Exception { - Component parent = new CompositeComponentImpl(URI.create("parent")); - parent.start(); - - Service service1 = EasyMock.createMock(Service.class); - EasyMock.expect(service1.getUri()).andReturn(URI.create("#child")).atLeastOnce(); - service1.stop(); - EasyMock.replay(service1); - - Reference service2 = EasyMock.createMock(Reference.class); - EasyMock.expect(service2.getUri()).andReturn(URI.create("#child")).atLeastOnce(); - service2.stop(); - EasyMock.replay(service2); - - parent.register(service2); - try { - parent.register(service1); - fail(); - } catch (DuplicateNameException e) { - // ok - } - parent.stop(); - - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java deleted file mode 100644 index 12299e762b..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import org.osoa.sca.RequestContext; - -import org.apache.tuscany.spi.component.WorkContext; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ManagedRequestContextTestCase extends TestCase { - - public void testGetServiceName() { - WorkContext workContext = EasyMock.createMock(WorkContext.class); - EasyMock.expect(workContext.getCurrentServiceName()).andReturn("foo"); - EasyMock.replay(workContext); - RequestContext context = new ManagedRequestContext(workContext); - assertEquals("foo", context.getServiceName()); - EasyMock.verify(workContext); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java deleted file mode 100644 index 34d37469a7..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ReferenceImplTestCase extends TestCase { - - public void testStart() { - ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class); - binding.start(); - EasyMock.replay(binding); - Reference reference = new ReferenceImpl(URI.create("ref"), null); - reference.addReferenceBinding(binding); - reference.start(); - EasyMock.verify(binding); - - } - - public void testStop() { - ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class); - binding.stop(); - EasyMock.replay(binding); - Reference reference = new ReferenceImpl(URI.create("ref"), null); - reference.addReferenceBinding(binding); - reference.stop(); - EasyMock.verify(binding); - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java deleted file mode 100644 index bb8ed020e0..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class ServiceImplTestCase extends TestCase { - - public void testStart() { - ServiceBinding binding = EasyMock.createMock(ServiceBinding.class); - binding.start(); - EasyMock.replay(binding); - Service service = new ServiceImpl(URI.create("foo#bar"), null, null); - service.addServiceBinding(binding); - service.start(); - EasyMock.verify(binding); - - } - - public void testStop() { - ServiceBinding binding = EasyMock.createMock(ServiceBinding.class); - binding.stop(); - EasyMock.replay(binding); - Service service = new ServiceImpl(URI.create("foo#bar"), null, null); - service.addServiceBinding(binding); - service.stop(); - EasyMock.verify(binding); - - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java deleted file mode 100644 index 876e68d5b3..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.injection; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class SingletonObjectFactoryTestCase extends TestCase { - - public void testSingleton() throws Exception { - Object o = new Object(); - SingletonObjectFactory factory = new SingletonObjectFactory(o); - assertEquals(o, factory.getInstance()); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java deleted file mode 100644 index 653d5d7335..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.OneWay; - -/** - * @version $Rev$ $Date$ - */ -public interface AsyncTarget { - @OneWay - void invoke(); - - int getCount(); -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java deleted file mode 100644 index 066acc346d..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Context; - -public class BadContextPojo { - - @Context - String context; - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java deleted file mode 100644 index 77ec37f9e4..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.ComponentName; - -public class BadNamePojo { - @ComponentName - private int name; -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java deleted file mode 100644 index b7921c248f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $Rev$ $Date$ - */ -public interface BasicInterface { - String returnsProperty(); - - BasicInterface returnsReference(); - - int returnsInt(); -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java deleted file mode 100644 index f7d7bb38cf..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * @version $Rev$ $Date$ - */ -public class BasicInterfaceImpl implements BasicInterface { - - @Property - public String publicProperty; - - @Reference (required = false) - public BasicInterface publicReference; - - @Property - protected String protectedProperty; - - @Reference (required = false) - protected BasicInterface protectedReference; - - private String privateProperty; - - private BasicInterface privateReference; - - @Property - public void setPrivateProperty(String privateProperty) { - this.privateProperty = privateProperty; - } - - @Reference (required = false) - public void setPrivateReference(BasicInterface privateReference) { - this.privateReference = privateReference; - } - - public String returnsProperty() { - return privateProperty; - } - - public BasicInterface returnsReference() { - return privateReference; - } - - public int returnsInt() { - return 0; - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java deleted file mode 100644 index 88b97216cd..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("COMPOSITE") -public interface CompositeScopeComponent { - - //public boolean isInit(); -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java deleted file mode 100644 index 93ee1f707a..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - - -/** - * @version $Rev$ $Date$ - */ -@Scope("COMPOSITE") -public class CompositeScopeComponentImpl implements - CompositeScopeComponent { - - private String foo; - - public void setFoo(String foo) { - this.foo = foo; - } - - public String getFoo() { - return foo; - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java deleted file mode 100644 index 16ce3b5569..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; - -public class CompositeScopeDestroyOnlyComponent extends CompositeScopeComponentImpl { - - boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java deleted file mode 100644 index 05b938a87c..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; - -public class CompositeScopeInitDestroyComponent extends CompositeScopeInitOnlyComponent { - - boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - if (destroyed) { - throw new AssertionError("Destroy called more than once"); - } - destroyed = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java deleted file mode 100644 index f9f80ca15c..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Init; - -public class CompositeScopeInitOnlyComponent extends CompositeScopeComponentImpl { - - private boolean 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; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - if (initialized) { - throw new AssertionError("Init called more than once"); - } - initialized = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java deleted file mode 100644 index c71ac0586f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $ - */ -@Scope("CONVERSATION") -public interface ConversationalScopeComponent { - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java deleted file mode 100644 index 5ea7278e1f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $ - */ -@Scope("CONVERSATION") -public class ConversationalScopeComponentImpl implements ConversationalScopeComponent { - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java deleted file mode 100644 index 8cea9efa49..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("CONVERSATION") -public class ConversationalScopeDestroyOnlyComponent extends ConversationalScopeComponentImpl { - - boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java deleted file mode 100644 index 40dbfedf2c..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("CONVERSATION") -public class ConversationalScopeInitDestroyComponent - extends ConversationalScopeInitOnlyComponent { - - private boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java deleted file mode 100644 index caaa0c39e7..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("CONVERSATION") -public class ConversationalScopeInitOnlyComponent - extends ConversationalScopeComponentImpl { - - private boolean initialized; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java deleted file mode 100644 index af257c226d..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java deleted file mode 100644 index 2033f0eca5..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface OrderedDependentPojo extends OrderedInitPojo { - - OrderedInitPojo getPojo(); - - void setPojo(OrderedInitPojo pojo); -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java deleted file mode 100644 index 439c3d143c..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class OrderedDependentPojoImpl extends OrderedInitPojoImpl implements OrderedDependentPojo { - - private OrderedInitPojo pojo; - - public OrderedInitPojo getPojo() { - return pojo; - } - - public void setPojo(OrderedInitPojo pojo) { - this.pojo = pojo; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java deleted file mode 100644 index 1986952747..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.EagerInit; - -@Scope("COMPOSITE") -@EagerInit -public class OrderedEagerInitPojo { - - private static final 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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java deleted file mode 100644 index 0b891cfa42..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface OrderedInitPojo { - int getNumberInstantiated(); - - int getInitOrder(); -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java deleted file mode 100644 index a7063f6353..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("COMPOSITE") -public class OrderedInitPojoImpl implements OrderedInitPojo { - - private static final Object LOCK = new Object(); - private static int numberInstantied; - private int initOrder; - - public OrderedInitPojoImpl() { - } - - @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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java deleted file mode 100644 index 0b897daa40..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface OtherTarget { - - String getString(); - - void setString(String val); -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java deleted file mode 100644 index a3b2bbf098..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * 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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java deleted file mode 100644 index 8c7dc107ee..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("REQUEST") -public interface RequestScopeComponent { - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java deleted file mode 100644 index 5224ceda5f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl { - - boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java deleted file mode 100644 index 38b188a4b5..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { - - boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java deleted file mode 100644 index 707f8ab50f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl { - - private boolean initialized; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java deleted file mode 100644 index 827ba804f2..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("SESSION") -public interface SessionScopeComponent { - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java deleted file mode 100644 index e547bf6113..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("SESSION") -public class SessionScopeComponentImpl implements - SessionScopeComponent { - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java deleted file mode 100644 index c11bd1bd49..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Destroy; - -public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { - - private boolean destroyed; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java deleted file mode 100644 index 095cc916ec..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Init; - -public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl { - - private boolean initialized; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java deleted file mode 100644 index c78ba00a7a..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -public interface SimpleTarget { - - String hello(String message) throws Exception; - - String goodbye(String message) throws Exception; - - String echo(String message) throws Exception; - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java deleted file mode 100644 index 634a07a401..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Source.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Source.java deleted file mode 100644 index f7969f748b..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Source.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import java.util.List; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Source { - - Target getTarget(); - - List getTargets(); - - List getTargetsThroughField(); - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java deleted file mode 100644 index 187e33b2bd..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -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; - private Target[] targetsArray; - - 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; - } - - public Target[] getArrayOfTargets() { - return targetsArray; - } - - public void setArrayOfTargets(Target[] targets) { - targetsArray = targets; - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java deleted file mode 100644 index c16ac942a3..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("STATELESS") -public interface StatelessComponent { - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java deleted file mode 100644 index 64a23c12c8..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $Rev$ $Date$ - */ -public class StatelessComponentImpl implements - StatelessComponent { - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Target.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Target.java deleted file mode 100644 index 778c14665d..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/Target.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Target { - - String getString(); - - void setString(String val); -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java deleted file mode 100644 index 037dd3a37c..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java deleted file mode 100644 index 98f5973f62..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.wire; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.TargetInvoker; -import org.apache.tuscany.spi.component.WorkContext; - -/** - * 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 MockStaticInvoker implements TargetInvoker { - - private Object instance; - private Method operation; - private boolean cacheable; - - - public MockStaticInvoker(Method operation, Object instance) { - this.operation = operation; - this.instance = instance; - } - - public boolean isCacheable() { - return cacheable; - } - - public void setCacheable(boolean cacheable) { - this.cacheable = cacheable; - } - - public boolean isOptimizable() { - return isCacheable(); - } - - public Object invokeTarget(final Object payload, final short sequence, WorkContext workContext) 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) throws InvocationRuntimeException { - try { - Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE, null); - msg.setBody(resp); - } catch (InvocationTargetException e) { - msg.setBodyWithFault(e.getCause()); - } catch (Throwable e) { - msg.setBodyWithFault(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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java deleted file mode 100644 index 1fe2c027ab..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.wire; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; - -public class MockSyncInterceptor implements Interceptor { - - private int count; - - private Interceptor next; - - public MockSyncInterceptor() { - } - - public Message invoke(Message msg) { - ++count; - return next.invoke(msg); - } - - public int getCount() { - return count; - } - - public void setNext(Interceptor next) { - this.next = next; - } - - public Interceptor getNext() { - return next; - } - - public boolean isOptimizable() { - return false; - } - -} - diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java deleted file mode 100644 index 3fcc75bdb4..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.mock.wire; - -import org.apache.tuscany.spi.wire.InvocationRuntimeException; -import org.apache.tuscany.spi.wire.Message; - -import org.apache.tuscany.core.binding.local.AbstractLocalTargetInvoker; - -/** - * @version $Rev$ $Date$ - */ -public class MockTargetInvoker extends AbstractLocalTargetInvoker { - public Message invoke(Message msg) throws InvocationRuntimeException { - return null; - } -} \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java deleted file mode 100644 index 437e718206..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import junit.framework.TestCase; -import org.apache.tuscany.api.TuscanyException; -import org.apache.tuscany.api.TuscanyRuntimeException; - -/** - * @version $Rev$ $Date$ - */ -public class DefaultExceptionFormatterTestCase extends TestCase { - private DefaultExceptionFormatter formatter = new DefaultExceptionFormatter(); - - public void testTuscanyExceptionFormat() throws Exception { - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - TuscanyException e = new TuscanyException("somemessage") { - }; - formatter.write(pw, e); - assertTrue(writer.toString().indexOf("somemessage") >= 0); - } - - public void testTuscanyRuntimeExceptionFormat() throws Exception { - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - TuscanyRuntimeException e = new TuscanyRuntimeException("somemessage") { - }; - formatter.write(pw, e); - assertTrue(writer.toString().indexOf("somemessage") >= 0); - } - - public void testNormalExceptionFormat() throws Exception { - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - Exception e = new Exception(); - formatter.write(pw, e); // just verify there are no errors since no formatting needs to be doen - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java deleted file mode 100644 index 5fdf035c7a..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.monitor; - -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 org.apache.tuscany.api.annotation.LogLevel; -import org.apache.tuscany.host.MonitorFactory; - -import junit.framework.TestCase; - -/** - * 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 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(); - - @LogLevel("INFO") - void eventWithNoArgs(); - - @LogLevel("INFO") - void eventWithOneArg(String msg); - - @LogLevel("WARNING") - void eventWithThrowable(Exception e); - - @LogLevel("INFO") - void eventWithAnnotation(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/resolver/DefaultAutowireResolverTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/resolver/DefaultAutowireResolverTestCase.java deleted file mode 100644 index 6d50489f18..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/resolver/DefaultAutowireResolverTestCase.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.resolver; - -import java.net.URI; - -import org.apache.tuscany.spi.model.AtomicImplementation; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.model.ServiceDefinition; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class DefaultAutowireResolverTestCase extends TestCase { - private static final URI REFERENCE_URI = URI.create("source#ref"); - private static final URI TARGET_URI = URI.create("target#service"); - private DefaultAutowireResolver resolver; - - public void testAutowireAtomicToAtomic() throws Exception { - ComponentDefinition composite = createComposite("composite"); - CompositeComponentType type = composite.getImplementation().getComponentType(); - ComponentDefinition source = createSourceAtomic(Foo.class); - type.add(source); - ComponentDefinition target = createTargetAtomic(Foo.class); - type.add(target); - resolver.resolve(null, composite); - ReferenceTarget refTarget = source.getReferenceTargets().get(REFERENCE_URI.getFragment()); - assertEquals(TARGET_URI, refTarget.getTargets().get(0)); - } - - public void testAutowireAtomicToAtomicRequiresSuperInterface() throws Exception { - ComponentDefinition composite = createComposite("composite"); - CompositeComponentType type = composite.getImplementation().getComponentType(); - ComponentDefinition source = createSourceAtomic(SuperFoo.class); - type.add(source); - ComponentDefinition target = createTargetAtomic(Foo.class); - type.add(target); - resolver.resolve(null, composite); - ReferenceTarget refTarget = source.getReferenceTargets().get(REFERENCE_URI.getFragment()); - assertEquals(TARGET_URI, refTarget.getTargets().get(0)); - } - - public void testAutowireAtomicToAtomicRequiresSubInterface() throws Exception { - ComponentDefinition composite = createComposite("composite"); - CompositeComponentType type = composite.getImplementation().getComponentType(); - ComponentDefinition source = createSourceAtomic(Foo.class); - type.add(source); - ComponentDefinition target = createTargetAtomic(SuperFoo.class); - type.add(target); - try { - resolver.resolve(null, composite); - fail(); - } catch (AutowireTargetNotFoundException e) { - // expected - } - } - - public void testAutowireAtomicToAtomicIncompatibleInterfaces() throws Exception { - ComponentDefinition composite = createComposite("composite"); - CompositeComponentType type = composite.getImplementation().getComponentType(); - ComponentDefinition source = createSourceAtomic(Foo.class); - type.add(source); - ComponentDefinition target = createTargetAtomic(String.class); - type.add(target); - try { - resolver.resolve(null, composite); - fail(); - } catch (AutowireTargetNotFoundException e) { - // expected - } - } - - public void testNestedAutowireAtomicToAtomic() throws Exception { - ComponentDefinition composite = createComposite("composite"); - CompositeComponentType type = composite.getImplementation().getComponentType(); - ComponentDefinition source = createSourceAtomic(Foo.class); - type.add(source); - ComponentDefinition target = createTargetAtomic(Foo.class); - type.add(target); - ComponentDefinition parent = createComposite("parent"); - parent.getImplementation().getComponentType().add(composite); - resolver.resolve(null, parent); - ReferenceTarget refTarget = source.getReferenceTargets().get(REFERENCE_URI.getFragment()); - assertEquals(TARGET_URI, refTarget.getTargets().get(0)); - } - - - protected void setUp() throws Exception { - super.setUp(); - resolver = new DefaultAutowireResolver(); - } - - private ComponentDefinition createComposite(String uri) { - URI parentUri = URI.create(uri); - CompositeComponentType> type = - new CompositeComponentType>(); - CompositeImplementation impl = new CompositeImplementation(); - impl.setComponentType(type); - return new ComponentDefinition(parentUri, impl); - } - - private ComponentDefinition createSourceAtomic(Class requiredInterface) { - URI uri = URI.create("source"); - ServiceContract contract = new ServiceContract() { - }; - contract.setInterfaceClass(requiredInterface); - ReferenceDefinition reference = new ReferenceDefinition(URI.create("#ref"), contract); - reference.setRequired(true); - MockComponentType type = new MockComponentType(); - type.add(reference); - MockAtomicImpl impl = new MockAtomicImpl(); - impl.setComponentType(type); - ComponentDefinition definition = new ComponentDefinition(uri, impl); - ReferenceTarget target = new ReferenceTarget(); - target.setReferenceName(REFERENCE_URI); - target.setAutowire(true); - definition.add(target); - return definition; - } - - private ComponentDefinition createTargetAtomic(Class serviceInterface) { - URI uri = URI.create("target"); - ServiceDefinition service = new ServiceDefinition(); - service.setUri(URI.create("#service")); - ServiceContract contract = new ServiceContract() { - }; - contract.setInterfaceClass(serviceInterface); - service.setServiceContract(contract); - MockComponentType type = new MockComponentType(); - type.add(service); - MockAtomicImpl impl = new MockAtomicImpl(); - impl.setComponentType(type); - return new ComponentDefinition(uri, impl); - } - - private class MockAtomicImpl extends AtomicImplementation { - - } - - private class MockComponentType extends ComponentType> { - - } - - private interface SuperFoo { - - } - - private interface Foo extends SuperFoo { - - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java deleted file mode 100644 index 06ea7cf903..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.services.store.memory; - -import java.net.URI; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.event.RuntimeEventListener; -import org.apache.tuscany.spi.services.store.DuplicateRecordException; -import org.apache.tuscany.spi.services.store.Store; -import org.apache.tuscany.spi.services.store.StoreExpirationEvent; -import org.apache.tuscany.spi.services.store.StoreMonitor; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import org.easymock.IAnswer; - -/** - * @version $Rev$ $Date$ - */ -public class MemoryStoreTestCase extends TestCase { - private StoreMonitor monitor; - - public void testEviction() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - store.insertRecord(component, id, value, 1); - Thread.sleep(100); - assertNull(store.readRecord(component, id)); - store.destroy(); - } - - public void testNotifyOnEviction() throws Exception { - final CountDownLatch latch = new CountDownLatch(1); - RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class); - listener.onEvent(EasyMock.isA(StoreExpirationEvent.class)); - org.easymock.classextension.EasyMock.expectLastCall().andStubAnswer(new IAnswer() { - public Object answer() throws Throwable { - latch.countDown(); - return null; - } - }); - EasyMock.replay(listener); - MemoryStore store = new MemoryStore(monitor); - store.addListener(listener); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - store.insertRecord(component, id, value, 1); - if (!latch.await(1000, TimeUnit.MILLISECONDS)) { - // failed to notify listener - fail(); - } - EasyMock.verify(listener); - } - - public void testNoEviction() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - store.insertRecord(component, id, value, Store.NEVER); - Thread.sleep(100); - assertNotNull(store.readRecord(component, id)); - store.destroy(); - } - - public void testInsertRecord() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - store.insertRecord(component, id, value, Store.NEVER); - store.destroy(); - } - - public void testInsertAlreadyExists() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getUri()).andReturn(URI.create("component")); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - store.insertRecord(component, id, value, Store.NEVER); - try { - store.insertRecord(component, id, value, Store.NEVER); - fail(); - } catch (DuplicateRecordException e) { - //expected - } - store.destroy(); - } - - public void testUpdateRecord() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - Object newValue = new Object(); - - store.insertRecord(component, id, value, Store.NEVER); - store.updateRecord(component, id, newValue, 1L); - assertEquals(newValue, store.readRecord(component, id)); - store.destroy(); - } - - public void testDeleteRecord() throws Exception { - MemoryStore store = new MemoryStore(monitor); - store.setReaperInterval(10); - store.init(); - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - String id = UUID.randomUUID().toString(); - Object value = new Object(); - - store.insertRecord(component, id, value, Store.NEVER); - store.removeRecord(component, id); - assertNull(store.readRecord(component, id)); - store.destroy(); - } - - protected void setUp() throws Exception { - super.setUp(); - monitor = EasyMock.createNiceMock(StoreMonitor.class); - EasyMock.replay(monitor); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean1.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean1.java deleted file mode 100644 index 79fad549aa..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean1.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.util; - - -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; - public String field3; - protected String field2; - private String field1; - - 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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean2.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean2.java deleted file mode 100644 index 7f7f03da9e..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/Bean2.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.util; - -import java.util.List; - -import junit.framework.AssertionFailedError; - -public class Bean2 { - - private List methodList; - private List fieldList; - - public List getMethodList() { - return methodList; - } - - public void setMethodList(List list) { - methodList = list; - } - - public List getfieldList() { - return fieldList; - } - - public void setfieldList(List list) { - throw new AssertionFailedError("setter inadvertantly called"); - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java deleted file mode 100644 index 797b147b54..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.util; - -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; - -import junit.framework.TestCase; -import org.apache.tuscany.core.mock.component.Target; - -public class JavaIntrospectionHelperTestCase extends TestCase { - - private List testNoGenericsList; - private List testList; - private Map testMap; - private Target[] testArray; - private String[] testStringArray; - - public JavaIntrospectionHelperTestCase() { - super(); - } - - public JavaIntrospectionHelperTestCase(String arg0) { - super(arg0); - } - - public void testBean1AllPublicProtectedFields() throws Exception { - Set beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class); - assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS - } - - public void testGetSuperAllMethods() throws Exception { - Set superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class); - assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size()); - } - - public void testGetBean1AllMethods() throws Exception { - Set beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class); - assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size()); - } - - public void testOverrideMethod() throws Exception { - Set beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(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.getAllUniquePublicProtectedMethods(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 testDefaultConstructor() throws Exception { - Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class); - assertEquals(ctr, Bean2.class.getConstructor()); - assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass()); - } - - - public void testGetAllInterfaces() { - Set interfaces = JavaIntrospectionHelper.getAllInterfaces(Z.class); - assertEquals(2, interfaces.size()); - assertTrue(interfaces.contains(W.class)); - assertTrue(interfaces.contains(W2.class)); - } - - - public void testGetAllInterfacesObject() { - Set interfaces = JavaIntrospectionHelper.getAllInterfaces(Object.class); - assertEquals(0, interfaces.size()); - } - - public void testGetAllInterfacesNoInterfaces() { - Set interfaces = JavaIntrospectionHelper.getAllInterfaces(NoInterface.class); - assertEquals(0, interfaces.size()); - } - - /** - * Tests generics introspection capabilities - */ - public void testGenerics() throws Exception { - - List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType()); - assertEquals(1, classes.size()); - assertEquals(String.class, classes.get(0)); - - classes = - JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType()); - assertEquals(0, classes.size()); - - classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType()); - assertEquals(2, classes.size()); - assertEquals(String.class, classes.get(0)); - assertEquals(Bean1.class, classes.get(1)); - - classes = JavaIntrospectionHelper - .getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]); - assertEquals(2, classes.size()); - assertEquals(String.class, classes.get(0)); - assertEquals(Bean1.class, classes.get(1)); - - classes = JavaIntrospectionHelper - .getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]); - assertEquals(1, classes.size()); - assertEquals(String.class, classes.get(0)); - - } - - private void fooMethod(List foo) { - - } - - private void fooMethod(Map foo) { - - } - - public void setTestArray(Target[] array) { - } - - private interface W { - - } - - private interface W2 { - - } - - private class X implements W { - - } - - private class Y extends X implements W, W2 { - - } - - private class Z extends Y { - - } - - private class NoInterface { - - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/SuperBean.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/SuperBean.java deleted file mode 100644 index 83aef7fb5e..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/util/SuperBean.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.util; - -/** - * @version $Rev$ $Date$ - */ -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; - public String superField2; - - protected String superField3; - - private String superField1; - - 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/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java deleted file mode 100644 index 6c50cb406f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.osoa.sca.NoRegisteredCallbackException; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class CallbackInterfaceInterceptorTestCase extends TestCase { - - public void testOptimize() throws Exception { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true); - assertFalse(interceptor.isOptimizable()); - } - - public void testImplements() { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true); - Interceptor next = EasyMock.createMock(Interceptor.class); - EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null); - EasyMock.replay(next); - interceptor.setNext(next); - interceptor.invoke(new MessageImpl()); - EasyMock.verify(next); - } - - public void testDoesNotImplement() { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(false); - try { - interceptor.invoke(new MessageImpl()); - fail(); - } catch (NoRegisteredCallbackException e) { - // expected - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java deleted file mode 100644 index c955faf7b1..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.spi.QualifiedName; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.model.DataType; -import org.apache.tuscany.spi.model.Operation; -import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; -import org.apache.tuscany.spi.wire.ProxyCreationException; -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.ProxyService; -import org.apache.tuscany.spi.wire.InvocationChain; - -import junit.framework.TestCase; -import org.osoa.sca.CallableReference; - -/** - * TODO some tests commented out due to DataType.equals() needing to be strict - * - * @version $Rev$ $Date$ - */ -public class ContractCompatibilityTestCase extends TestCase { - - private ProxyService proxyService = new MockProxyService(); - - public void testNoOperation() throws Exception { - ServiceContract source = new MockContract("FooContract"); - ServiceContract target = new MockContract("FooContract"); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testBasic() throws Exception { - ServiceContract source = new MockContract("FooContract"); - Operation opSource1 = new Operation("op1", null, null, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - ServiceContract target = new MockContract("FooContract"); - Operation opSource2 = new Operation("op1", null, null, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opSource2); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testBasicIncompatibleOperationNames() throws Exception { - ServiceContract source = new MockContract("FooContract"); - Operation opSource1 = new Operation("op1", null, null, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - ServiceContract target = new MockContract("FooContract"); - Operation opSource2 = new Operation("op2", null, null, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op2", opSource2); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - public void testInputTypes() throws Exception { - ServiceContract source = new MockContract("FooContract"); - List> sourceInputTypes = new ArrayList>(); - sourceInputTypes.add(new DataType(Object.class, Object.class)); - DataType>> inputType = new DataType>>(String.class, sourceInputTypes); - Operation opSource1 = new Operation("op1", inputType, null, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - List> targetInputTypes = new ArrayList>(); - targetInputTypes.add(new DataType(Object.class, Object.class)); - DataType>> targetInputType = - new DataType>>(String.class, targetInputTypes); - - Operation opTarget = - new Operation("op1", targetInputType, null, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - - public void testIncompatibleInputTypes() throws Exception { - ServiceContract source = new MockContract("FooContract"); - List> sourceInputTypes = new ArrayList>(); - sourceInputTypes.add(new DataType(Integer.class, Integer.class)); - DataType>> inputType = new DataType>>(String.class, sourceInputTypes); - Operation opSource1 = new Operation("op1", inputType, null, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - List> targetInputTypes = new ArrayList>(); - targetInputTypes.add(new DataType(String.class, String.class)); - DataType>> targetInputType = - new DataType>>(String.class, targetInputTypes); - - Operation opTarget = - new Operation("op1", targetInputType, null, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - /** - * Verfies source input types can be super types of the target - */ - public void testSourceSuperTypeInputCompatibility() throws Exception { -// ServiceContract source = new MockContract("FooContract"); -// List> sourceInputTypes = new ArrayList>(); -// sourceInputTypes.add(new DataType(Object.class, Object.class)); -// DataType>> inputType = new DataType>>(String.class, sourceInputTypes); -// Operation opSource1 = new Operation("op1", inputType, null, null, false, null); -// Map> sourceOperations = new HashMap>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract target = new MockContract("FooContract"); -// List> targetInputTypes = new ArrayList>(); -// targetInputTypes.add(new DataType(String.class, String.class)); -// DataType>> targetInputType = -// new DataType>>(String.class, targetInputTypes); -// -// Operation opTarget = new Operation("op1", targetInputType, null, null, false, null); -// Map> targetOperations = new HashMap>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - public void testOutputTypes() throws Exception { - ServiceContract source = new MockContract("FooContract"); - DataType sourceOutputType = new DataType(String.class, String.class); - Operation opSource1 = - new Operation("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - DataType targetOutputType = new DataType(String.class, String.class); - Operation opTarget = - new Operation("op1", null, targetOutputType, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - /** - * Verfies a return type that is a supertype of of the target is compatible - */ - public void testSupertypeOutputTypes() throws Exception { -// ServiceContract source = new MockContract("FooContract"); -// DataType sourceOutputType = new DataType(Object.class, Object.class); -// Operation opSource1 = new Operation("op1", null, sourceOutputType, null, false, null); -// Map> sourceOperations = new HashMap>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract target = new MockContract("FooContract"); -// DataType targetOutputType = new DataType(String.class, String.class); -// Operation opTarget = new Operation("op1", null, targetOutputType, null, false, null); -// Map> targetOperations = new HashMap>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - public void testIncompatibleOutputTypes() throws Exception { - ServiceContract source = new MockContract("FooContract"); - DataType sourceOutputType = new DataType(String.class, String.class); - Operation opSource1 = - new Operation("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - DataType targetOutputType = new DataType(Integer.class, Integer.class); - Operation opTarget = - new Operation("op1", null, targetOutputType, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - public void testFaultTypes() throws Exception { - ServiceContract source = new MockContract("FooContract"); - DataType sourceFaultType = new DataType(String.class, String.class); - List> sourceFaultTypes = new ArrayList>(); - sourceFaultTypes.add(0, sourceFaultType); - Operation opSource1 = - new Operation("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - DataType targetFaultType = new DataType(String.class, String.class); - List> targetFaultTypes = new ArrayList>(); - targetFaultTypes.add(0, targetFaultType); - - Operation opTarget = - new Operation("op1", null, null, targetFaultTypes, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testSourceFaultTargetNoFaultCompatibility() throws Exception { - ServiceContract source = new MockContract("FooContract"); - DataType sourceFaultType = new DataType(String.class, String.class); - List> sourceFaultTypes = new ArrayList>(); - sourceFaultTypes.add(0, sourceFaultType); - Operation opSource1 = - new Operation("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION); - Map> sourceOperations = new HashMap>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract target = new MockContract("FooContract"); - Operation opTarget = new Operation("op1", null, null, null, false, null, NO_CONVERSATION); - Map> targetOperations = new HashMap>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - /** - * Verifies a source's fault which is a supertype of the target's fault are compatibile - * - * @throws Exception - */ - public void testFaultSuperTypes() throws Exception { -// ServiceContract source = new MockContract("FooContract"); -// DataType sourceFaultType = new DataType(Exception.class, Exception.class); -// List> sourceFaultTypes = new ArrayList>(); -// sourceFaultTypes.add(0, sourceFaultType); -// Operation opSource1 = new Operation("op1", null, null, sourceFaultTypes, false, null); -// Map> sourceOperations = new HashMap>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract target = new MockContract("FooContract"); -// DataType targetFaultType = new DataType(TuscanyException.class, TuscanyException.class); -// List> targetFaultTypes = new ArrayList>(); -// targetFaultTypes.add(0, targetFaultType); -// -// Operation opTarget = new Operation("op1", null, null, targetFaultTypes, false, null); -// Map> targetOperations = new HashMap>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - /** - * Verifies a source's faults which are supertypes and a superset of the target's faults are compatibile - */ - public void testFaultSuperTypesAndSuperset() throws Exception { -// ServiceContract source = new MockContract("FooContract"); -// DataType sourceFaultType = new DataType(Exception.class, Exception.class); -// DataType sourceFaultType2 = new DataType(RuntimeException.class, RuntimeException.class); -// List> sourceFaultTypes = new ArrayList>(); -// sourceFaultTypes.add(0, sourceFaultType); -// sourceFaultTypes.add(1, sourceFaultType2); -// Operation opSource1 = new Operation("op1", null, null, sourceFaultTypes, false, null); -// Map> sourceOperations = new HashMap>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract target = new MockContract("FooContract"); -// DataType targetFaultType = new DataType(TuscanyException.class, TuscanyException.class); -// List> targetFaultTypes = new ArrayList>(); -// targetFaultTypes.add(0, targetFaultType); -// -// Operation opTarget = new Operation("op1", null, null, targetFaultTypes, false, null); -// Map> targetOperations = new HashMap>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - private class MockContract extends ServiceContract { - public MockContract() { - } - - public MockContract(Class interfaceClass) { - super(interfaceClass); - } - - public MockContract(String interfaceName) { - super(interfaceName); - } - } - - private class MockProxyService extends ProxyServiceExtension { - public MockProxyService() { - super(null); - } - - public T createProxy(Class interfaze, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public T createProxy2(Class interfaze, boolean conversational, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public T createProxy2(Class interfaze, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public T createProxy(Class interfaze, Wire wire, Map mapping) - throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public T createProxy2(Class interfaze, Wire wire, Map mapping) - throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public Object createCallbackProxy(Class interfaze, List wires) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public Object createCallbackProxy(Class interfaze) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public void createWires(ReferenceBinding referenceBinding, ServiceContract contract, - QualifiedName targetName) { - throw new UnsupportedOperationException(); - } - - public > R cast(B target) throws IllegalArgumentException { - throw new UnsupportedOperationException(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java deleted file mode 100644 index a9f455bc62..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; - -import junit.framework.TestCase; -import org.apache.tuscany.host.monitor.FormatterRegistry; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class IncompatibleServiceContractExceptionFormatterTestCase extends TestCase { - FormatterRegistry registry = EasyMock.createNiceMock(FormatterRegistry.class); - IncompatibleServiceContractExceptionFormatter formatter = - new IncompatibleServiceContractExceptionFormatter(registry); - - public void testFormat() throws Exception { - ServiceContract source = new ServiceContract() { - }; - source.setInterfaceName("sourceInterface"); - ServiceContract target = new ServiceContract() { - }; - target.setInterfaceName("targetInterface"); - Operation sourceOp = new Operation("sourceOp", null, null, null); - Operation targetOp = new Operation("targetOp", null, null, null); - - IncompatibleServiceContractException e = - new IncompatibleServiceContractException("message", source, target, sourceOp, targetOp); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("sourceInterface") >= 0); - assertTrue(buffer.indexOf("targetInterface") >= 0); - assertTrue(buffer.indexOf("sourceOp") >= 0); - assertTrue(buffer.indexOf("targetOp") >= 0); - } - - - public void testFormatNulls() throws Exception { - ServiceContract source = new ServiceContract() { - }; - source.setInterfaceName("sourceInterface"); - ServiceContract target = new ServiceContract() { - }; - target.setInterfaceName("targetInterface"); - - IncompatibleServiceContractException e = - new IncompatibleServiceContractException("message", source, target); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("sourceInterface") >= 0); - assertTrue(buffer.indexOf("targetInterface") >= 0); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java deleted file mode 100644 index 9875058abb..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.InvocationChain; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class InvocationChainImplTestCase extends TestCase { - - public void testInsertAtPos() throws Exception { - InvocationChain chain = new InvocationChainImpl(new Operation("foo", null, null, null)); - Interceptor inter3 = new MockInterceptor(); - Interceptor inter2 = new MockInterceptor(); - Interceptor inter1 = new MockInterceptor(); - chain.addInterceptor(inter3); - chain.addInterceptor(0, inter1); - chain.addInterceptor(1, inter2); - Interceptor head = chain.getHeadInterceptor(); - assertEquals(inter1, head); - assertEquals(inter2, head.getNext()); - assertEquals(inter3, head.getNext().getNext()); - } - - public void testInsertAtEnd() throws Exception { - InvocationChain chain = new InvocationChainImpl(new Operation("foo", null, null, null)); - Interceptor inter2 = new MockInterceptor(); - Interceptor inter1 = new MockInterceptor(); - chain.addInterceptor(0, inter1); - chain.addInterceptor(1, inter2); - Interceptor head = chain.getHeadInterceptor(); - assertEquals(inter1, head); - assertEquals(inter2, head.getNext()); - assertEquals(inter2, chain.getTailInterceptor()); - - } - - private class MockInterceptor implements Interceptor { - - private Interceptor next; - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - this.next = next; - } - - public Interceptor getNext() { - return next; - } - - public boolean isOptimizable() { - return false; - } - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java deleted file mode 100644 index c563217306..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import static org.apache.tuscany.core.wire.NonBlockingInterceptorBuilder.QNAME; - -import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class NonBlockingInterceptorBuilderTestCase extends TestCase { - - public void testBuild() throws Exception { - NonBlockingInterceptorBuilder builder = new NonBlockingInterceptorBuilder(null, null); - PhysicalInterceptorDefinition definition = new PhysicalInterceptorDefinition(QNAME); - definition.setBuilder(QNAME); - assertTrue(builder.build(definition) instanceof NonBlockingInterceptor); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java deleted file mode 100644 index c08d1453db..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.work.WorkScheduler; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.getCurrentArguments; -import static org.easymock.EasyMock.isA; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import org.easymock.IAnswer; - -/** - * @version $Rev$ $Date$ - */ -public class NonBlockingInterceptorTestCase extends TestCase { - - public void testInvoke() throws Exception { - WorkScheduler scheduler = createMock(WorkScheduler.class); - scheduler.scheduleWork(isA(Runnable.class)); - expectLastCall().andStubAnswer(new IAnswer() { - public Object answer() throws Throwable { - Runnable runnable = (Runnable) getCurrentArguments()[0]; - runnable.run(); - return null; - } - }); - replay(scheduler); - WorkContext context = createMock(WorkContext.class); - String convID = "convID"; - EasyMock.expect(context.getIdentifier(Scope.CONVERSATION)).andReturn(convID); - context.setCorrelationId(null); - context.setIdentifier(Scope.CONVERSATION, convID); - EasyMock.replay(context); - Message msg = new MessageImpl(); - Interceptor next = EasyMock.createMock(Interceptor.class); - EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg); - EasyMock.replay(next); - Interceptor interceptor = new NonBlockingInterceptor(scheduler, context, next); - interceptor.invoke(msg); - verify(context); - verify(next); - } - - public void testOptimizable() { - NonBlockingInterceptor interceptor = new NonBlockingInterceptor(null, null); - assertFalse(interceptor.isOptimizable()); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java deleted file mode 100644 index 5293678d12..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class OptimizedWireObjectFactoryTestCase extends TestCase { - - public void testGetInstance() throws Exception { - Foo foo = new Foo(); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.getTargetInstance()).andReturn(foo); - EasyMock.replay(wire); - OptimizedWireObjectFactory factory = new OptimizedWireObjectFactory(Foo.class, wire); - assertEquals(foo, factory.getInstance()); - EasyMock.verify(wire); - } - - private class Foo { - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java deleted file mode 100644 index e337133523..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WireImplTestCase extends TestCase { - - /** - * Tests that the target wire returns null if there is no connected wire. This behavior is needed for optional - * autowires. - */ - public void testGetNonExistentTarget() throws Exception { - Wire wire = new WireImpl(); - assertNull(wire.getTargetInstance()); - } - - public void testTargetInstance() throws Exception { - Wire wire = new WireImpl(); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getTargetInstance()).andReturn(new Object()); - EasyMock.replay(component); - wire.setTarget(component); - assertNotNull(wire.getTargetInstance()); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java deleted file mode 100644 index 9f21b9efdb..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.idl.java.JavaServiceContract; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.ProxyService; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WireObjectFactoryTestCase extends TestCase { - - @SuppressWarnings({"unchecked"}) - public void testCreateInstance() throws Exception { - Operation op = new Operation("hello", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - Wire wire = EasyMock.createMock(Wire.class); - Map, InvocationChain> chains = new HashMap, InvocationChain>(); - chains.put(op, chain); - EasyMock.expect(wire.getInvocationChains()).andReturn(chains); - EasyMock.expect(wire.isOptimizable()).andReturn(false); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory factory = new WireObjectFactory(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - @SuppressWarnings("unchecked") - public void testOptimizedCreateInstance() throws Exception { - ServiceContract contract = new JavaServiceContract(Foo.class); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.expect(wire.getTargetInstance()).andReturn(new Foo() { - public void hello() { - } - }); - EasyMock.replay(wire); - WireObjectFactory factory = new WireObjectFactory(Foo.class, wire, null); - factory.getInstance(); - EasyMock.verify(wire); - - } - - /** - * Verifies that a proxy is created when the required client contract is different than the wire contract - */ - @SuppressWarnings("unchecked") - public void testCannotOptimizeDifferentContractsCreateInstance() throws Exception { - ServiceContract contract = new JavaServiceContract(Object.class); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory factory = new WireObjectFactory(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - @SuppressWarnings("unchecked") - public void testNoJavaInterfaceCreateInstance() throws Exception { - ServiceContract contract = new JavaServiceContract(); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory factory = new WireObjectFactory(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - private interface Foo { - void hello(); - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java deleted file mode 100644 index 1db3892471..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.model.Operation; -import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * Verifies wire optimization analysis - * - * @version $$Rev$$ $$Date$$ - */ -public class WireOptimizationTestCase extends TestCase { - private Operation operation; - - public void foo() { - } - - public void testWireInterceptorOptimization() throws Exception { - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - Wire wire = new WireImpl(); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(new OptimizableInterceptor()); - wire.addInvocationChain(operation, chain); - assertTrue(WireUtils.isOptimizable(wire)); - } - - public void testWireNonInterceptorOptimization() throws Exception { - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - Wire wire = new WireImpl(); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(new NonOptimizableInterceptor()); - wire.addInvocationChain(operation, chain); - assertFalse(WireUtils.isOptimizable(wire)); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - protected void setUp() throws Exception { - super.setUp(); - operation = new Operation("foo", null, null, null, false, null, NO_CONVERSATION); - - } - - private class OptimizableInterceptor implements Interceptor { - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return true; - } - } - - private class NonOptimizableInterceptor implements Interceptor { - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return false; - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java deleted file mode 100644 index a9da65e0ba..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Map; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class WireUtilsTestCase extends TestCase { - private Method m; - - public void testCreateInterfaceToWireMapping() throws Exception { - Wire wire = new WireImpl(); - Operation op = new Operation("hello", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - wire.addInvocationChain(op, chain); - Map chains = WireUtils.createInterfaceToWireMapping(Foo.class, wire); - assertEquals(1, chains.size()); - assertNotNull(chains.get(m)); - } - - public void testCreateInterfaceToWireMappingNoOperation() throws Exception { - Wire wire = new WireImpl(); - Operation op = new Operation("goodbye", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - wire.addInvocationChain(op, chain); - try { - WireUtils.createInterfaceToWireMapping(Foo.class, wire); - fail(); - } catch (NoMethodForOperationException e) { - // expected - } - } - - protected void setUp() throws Exception { - super.setUp(); - m = Foo.class.getMethod("hello"); - } - - private interface Foo { - void hello(); - } -} diff --git a/sandbox/rfeng/minicore/src/test/resources/deployables/sample-calculator.jar b/sandbox/rfeng/minicore/src/test/resources/deployables/sample-calculator.jar deleted file mode 100644 index 0ca3a1b781..0000000000 Binary files a/sandbox/rfeng/minicore/src/test/resources/deployables/sample-calculator.jar and /dev/null differ diff --git a/sandbox/rfeng/minicore/src/test/resources/marshall/javaChangeSet.xml b/sandbox/rfeng/minicore/src/test/resources/marshall/javaChangeSet.xml deleted file mode 100644 index 2ac4c6932e..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/marshall/javaChangeSet.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - #123 - - AB12345 - - - - - - #123 - - com.acme.Foo - init - destroy - java.lang.String - java.lang.Long - - - - - - - - - - - - - java.lang.String - java.lang.Long - java.lang.Object - - - - - - - - - java.lang.String - java.lang.Long - java.lang.Object - - - - \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl deleted file mode 100644 index 838dbf6a9c..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl deleted file mode 100644 index 8a71aa5698..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - propval - - - - - diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl deleted file mode 100644 index a4f5ecf1e9..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .m2/repository - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl deleted file mode 100644 index ee75ea23f0..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl deleted file mode 100644 index 584846504b..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl +++ /dev/null @@ -1,22 +0,0 @@ - - - - This file just needs to exist - \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl deleted file mode 100644 index 0860855d9d..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/property/ipo.xml b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/property/ipo.xml deleted file mode 100644 index 5bef464cf7..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/property/ipo.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - Helen Zoe - 47 Eden Street - Cambridge - CB1 1JR - - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - - - - Lapis necklace - 1 - 99.95 - Want this for the holidays - 1999-12-05 - - - - diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext deleted file mode 100644 index 042f3ce1f3..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ diff --git a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl b/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl deleted file mode 100644 index 1e09549194..0000000000 --- a/sandbox/rfeng/minicore/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl +++ /dev/null @@ -1,22 +0,0 @@ - - - - This file just needs to exist - \ No newline at end of file diff --git a/sandbox/rfeng/minicore/src/test/resources/repository/sample-calculator.jar b/sandbox/rfeng/minicore/src/test/resources/repository/sample-calculator.jar deleted file mode 100644 index 0ca3a1b781..0000000000 Binary files a/sandbox/rfeng/minicore/src/test/resources/repository/sample-calculator.jar and /dev/null differ diff --git a/sandbox/rfeng/runtime/embedded/.checkstyle b/sandbox/rfeng/runtime/embedded/.checkstyle deleted file mode 100644 index ea05637a07..0000000000 --- a/sandbox/rfeng/runtime/embedded/.checkstyle +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/.pmd b/sandbox/rfeng/runtime/embedded/.pmd deleted file mode 100644 index 3493a9e386..0000000000 --- a/sandbox/rfeng/runtime/embedded/.pmd +++ /dev/null @@ -1,20 +0,0 @@ - - -truefalse \ No newline at end of file diff --git a/sandbox/rfeng/runtime/embedded/.ruleset b/sandbox/rfeng/runtime/embedded/.ruleset deleted file mode 100644 index a7ff3be272..0000000000 --- a/sandbox/rfeng/runtime/embedded/.ruleset +++ /dev/null @@ -1,190 +0,0 @@ - - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/LICENSE.txt b/sandbox/rfeng/runtime/embedded/LICENSE.txt deleted file mode 100644 index 0084319535..0000000000 --- a/sandbox/rfeng/runtime/embedded/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, serviceDefinition 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. diff --git a/sandbox/rfeng/runtime/embedded/NOTICE.txt b/sandbox/rfeng/runtime/embedded/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/sandbox/rfeng/runtime/embedded/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/rfeng/runtime/embedded/pom.xml b/sandbox/rfeng/runtime/embedded/pom.xml deleted file mode 100644 index a51ff50160..0000000000 --- a/sandbox/rfeng/runtime/embedded/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - org.apache.tuscany.sca - runtime - 2.0-alpha2-incubating-SNAPSHOT - - 4.0.0 - org.apache.tuscany.sca.runtime.embedded - embedded-host - jar - Apache Tuscany Embedded Runtime Host - Host code to support an embedded runtime - - - - org.apache.tuscany.sca.kernel - tuscany-core - 2.0-alpha2-incubating-SNAPSHOT - compile - - - junit - junit - 4.2 - test - - - diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java deleted file mode 100644 index 8fb945a28a..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.api; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.osoa.sca.ComponentContext; - -/** - * SCARuntime is used to start a Tuscany SCA runtime. - */ -public abstract class SCARuntime { - - private static SCARuntime instance; - - /** - * Read the service name from a configuration file - * - * @param classLoader - * @param name The name of the service class - * @return A class name which extends/implements the service class - * @throws IOException - */ - private static String getServiceName(ClassLoader classLoader, String name) throws IOException { - InputStream is = classLoader.getResourceAsStream("META-INF/services/" + name); - if (is == null) { - return null; - } - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(is)); - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } else if (!line.startsWith("#")) { - return line.trim(); - } - } - } finally { - if (reader != null) { - reader.close(); - } - } - return null; - } - - /** - * Returns a SCARuntime instance. If the system property - * "org.apache.tuscany.api.SCARuntime" is set, its value is used as the name - * of the implementation class. Otherwise, if the resource - * "META-INF/services/org.apache.tuscany.api.SCARuntime" can be loaded from - * the supplied classloader. Otherwise, it will use - * "org.apache.tuscany.runtime.embedded.DefaultSCARuntime" as the default. - * The named class is loaded from the supplied classloader and instantiated - * using its default (no-arg) constructor. - * - * @return - */ - private static SCARuntime newInstance(final ClassLoader classLoader) { - - try { - final String name = SCARuntime.class.getName(); - String className = AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty(name); - } - }); - - if (className == null) { - className = getServiceName(classLoader, name); - } - if (className == null) { - className = "org.apache.tuscany.runtime.embedded.DefaultSCARuntime"; - } - Class cls = Class.forName(className, true, classLoader); - return (SCARuntime)cls.newInstance(); // NOPMD lresende - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Get an instance of SCA Runtime - * - * @return The instance - */ - public static synchronized SCARuntime getInstance() { // NOPMD - if (instance != null) { - return instance; - } - ClassLoader classLoader = SCARuntime.class.getClassLoader(); - instance = newInstance(classLoader); - return instance; - } - - /** - * Start the Tuscany runtime using default SCDLs - */ - public static void start() { - try { - getInstance().startup(null, null, null, null); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDLs - * - * @param system The URL for the system SCDL - * @param extensions An array of URLs for extensions - * @param application The URL for the application SCDL - */ - public static void start(URL system, URL[] extensions, URL application, String compositePath) { - try { - getInstance().startup(system, extensions, application, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param application The URL for the application SCDL - */ - public static void start(URL application, String compositePath) { - try { - getInstance().startup(null, null, application, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param compositePath The path of the application SCDL - */ - public static void start(String compositePath) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL applicationURL = cl.getResource(compositePath); - getInstance().startup(null, null, applicationURL, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param compositePath The path of the system SCDL - * @param compositePath The path of the application SCDL - */ - public static void start(String system, String compositePath) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL systemURL = cl.getResource(system); - URL applicationURL = cl.getResource(compositePath); - getInstance().startup(systemURL, null, applicationURL, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Get the ComponentContext by name - * - * @param componentName - * @return - */ - public static ComponentContext getComponentContext(String componentName) { - return getInstance().getContext(componentName); - } - - /** - * Get access to a system service - * - * @param serviceName - * @return - */ - protected abstract Object getSystemService(String serviceName); - - /** - * Stop the SCA Runtime - */ - public static void stop() { - try { - getInstance().shutdown(); - } catch (Exception e) { - throw new IllegalStateException(e); - } finally { - instance = null; - } - } - - /** - * Look up the ComponentContext by name - * - * @param componentName - * @return - */ - protected abstract ComponentContext getContext(String componentName); - - /** - * Start up the runtime - * - * @param system The URL of the SCDL for tuscany system composite - * @param extensions The URLs of the SCDLs for tuscany extension composites - * @param application The URL of the SCDL for the application composite - * @param compositePath The path of the application composite relative to - * the application URL - * @throws Exception - */ - protected abstract void startup(URL system, URL[] extensions, URL application, String compositePath) - throws Exception; - - /** - * Shutdown the runtime - * - * @throws Exception - */ - protected abstract void shutdown() throws Exception; -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java deleted file mode 100644 index 1a6ab28cf4..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.runtime.embedded; - -import java.net.URI; -import java.net.URL; -import java.util.Arrays; -import java.util.List; - -import org.apache.tuscany.api.SCARuntime; -import org.apache.tuscany.api.TuscanyException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceUnavailableException; - -/** - * Default implementation of SCARuntime. - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings("deprecation") -public class DefaultSCARuntime extends SCARuntime { - - protected SimpleRuntime runtime; - - protected void startup(URL system, URL[] exts, URL applicationSCDL, String compositePath) throws Exception { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - List extensions = exts == null ? null : Arrays.asList(exts); - URI contributionURI = URI.create("/default"); - SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(cl, system, extensions, contributionURI, - applicationSCDL, compositePath); - runtime = new SimpleRuntimeImpl(runtimeInfo); - - try { - runtime.start(); - } catch (TuscanyException e) { - throw e; - } - - } - - protected void shutdown() throws Exception { - runtime.destroy(); - } - - @Override - protected ComponentContext getContext(String componentName) { - return runtime.getComponentContext(URI.create(SimpleRuntimeInfo.DEFAULT_COMPOSITE + "/" + componentName)); - } - - @Override - public Object getSystemService(String serviceName) { - try { - return runtime.getSystemService(Object.class, serviceName); - } catch (TargetResolutionException e) { - throw new ServiceUnavailableException(e); - } - } -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java deleted file mode 100644 index 676d42a3af..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.runtime.embedded; - -import org.apache.tuscany.host.runtime.TuscanyRuntime; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.TargetResolutionException; - -/** - * A simple runtime to host both Tuscany and application code on the same classpath - * - * @version $Rev$ $Date$ - */ -public interface SimpleRuntime extends TuscanyRuntime { - /** - * Start the embedded Tuscany - * @return - * @throws Exception - */ - Component start() throws Exception; - - /** - * Look up system services by name - * @param - * @param type - * @param name - * @return - * @throws TargetResolutionException - */ - T getSystemService(Class type, String name) throws TargetResolutionException; -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java deleted file mode 100644 index 990fa0107f..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.runtime.embedded; - -import static org.apache.tuscany.runtime.embedded.SimpleRuntimeInfo.DEFAULT_COMPOSITE; - -import java.net.URI; -import java.net.URL; -import java.util.Collection; - -import org.apache.tuscany.api.annotation.LogLevel; -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.core.implementation.PojoWorkContextTunnel; -import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation; -import org.apache.tuscany.core.runtime.AbstractRuntime; -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentException; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeImplementation; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeImpl extends AbstractRuntime implements SimpleRuntime { - private ScopeContainer container; - - public SimpleRuntimeImpl(SimpleRuntimeInfo runtimeInfo) { - super(SimpleRuntimeInfo.class); - ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader(); - setHostClassLoader(hostClassLoader); - setApplicationScdl(runtimeInfo.getApplicationSCDL()); - setSystemScdl(runtimeInfo.getSystemSCDL()); - setRuntimeInfo(runtimeInfo); - } - - public interface SimpleMonitor { - @LogLevel("SEVERE") - void runError(Exception e); - } - - protected Collection deployExtension(Component parent, - URI name, - URL extensionSCDL, - ClassLoader systemClassLoader) throws LoaderException, - BuilderException, ComponentException, ResolutionException { - - SystemCompositeImplementation impl = new SystemCompositeImplementation(); - impl.setScdlLocation(extensionSCDL); - impl.setClassLoader(systemClassLoader); - ComponentDefinition definition - = new ComponentDefinition(name, impl); - - Collection components = getDeployer().deploy(parent, definition); - for (Component component : components) { - component.start(); - } - return components; - } - - @SuppressWarnings("unchecked") - public Component start() throws Exception { - initialize(); - - ScopeRegistry scopeRegistry = getScopeRegistry(); - container = scopeRegistry.getScopeContainer(Scope.COMPOSITE); - - /* - int i = 0; - for (URL ext : runtimeInfo.getExtensionSCDLs()) { - URI uri = URI.create("/extensions/extension" + (i++)); - deployExtension(null, uri, ext, runtimeInfo.getClassLoader()); - } - */ - - CompositeImplementation impl = new CompositeImplementation(); - impl.setScdlLocation(applicationScdl); - impl.setClassLoader(runtimeInfo.getClassLoader()); - - ComponentDefinition definition - = new ComponentDefinition(DEFAULT_COMPOSITE, impl); - Collection components = getDeployer().deploy(null, definition); - for (Component component : components) { - component.start(); - } - container.startContext(DEFAULT_COMPOSITE, DEFAULT_COMPOSITE); - getWorkContext().setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE); - WorkContext workContext = new SimpleWorkContext(); - workContext.setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE); - PojoWorkContextTunnel.setThreadWorkContext(workContext); - return componentManager.getComponent(definition.getUri()); - } - - @SuppressWarnings("deprecation") - public T getSystemService(Class type, String name) throws TargetResolutionException { - SCAObject child = componentManager.getComponent(URI.create(name)); - if (child == null) { - return null; - } - AtomicComponent service = (AtomicComponent)child; - return type.cast(service.getTargetInstance()); - } - - @Override - public void destroy() { - container.stopContext(DEFAULT_COMPOSITE); - getWorkContext().setIdentifier(Scope.COMPOSITE, null); - super.destroy(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java deleted file mode 100644 index 740c51a3a3..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.runtime.embedded; - -import java.net.URI; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.host.RuntimeInfo; -import org.apache.tuscany.spi.bootstrap.ComponentNames; - -/** - * @version $Rev$ $Date$ - */ -public interface SimpleRuntimeInfo extends RuntimeInfo { - URI DEFAULT_COMPOSITE = ComponentNames.TUSCANY_APPLICATION_ROOT.resolve("default"); - - String DEFAULT_SYSTEM_SCDL = "META-INF/tuscany/default-system.composite"; - String SYSTEM_SCDL = "system.composite"; - String EXTENSION_SCDL = "META-INF/sca/extension.composite"; - String SERVICE_SCDL = "META-INF/sca/service.composite"; - String META_APPLICATION_SCDL = "META-INF/sca/application.composite"; - String APPLICATION_SCDL = "application.composite"; - - ClassLoader getClassLoader(); - - String getCompositePath(); - - URL getSystemSCDL(); - - URL getApplicationSCDL(); - - List getExtensionSCDLs(); - - URL getContributionRoot(); - - URI getContributionURI(); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java deleted file mode 100644 index 6839eefc93..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.runtime.embedded; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; - -import org.apache.tuscany.core.util.FileHelper; -import org.apache.tuscany.host.AbstractRuntimeInfo; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeInfoImpl extends AbstractRuntimeInfo implements SimpleRuntimeInfo { - private ClassLoader classLoader; - private String compositePath; - - private List extensions; - private URL applicationSCDL; - private URL systemSCDL; - - private URL contributionURL; - private URI contributionURI; - - /** - * @param classLoader - * @param compositePath - * @param extensions - * @param applicationSCDL - * @param systemSCDL - */ - public SimpleRuntimeInfoImpl(ClassLoader classLoader, - URL systemSCDL, - List extensions, - URI contributionURI, - URL applicationSCDL, - String compositePath) { - this(classLoader, compositePath); - this.extensions = extensions; - this.applicationSCDL = applicationSCDL; - this.systemSCDL = systemSCDL; - this.contributionURI = contributionURI; - } - - public SimpleRuntimeInfoImpl(ClassLoader classLoader, String compositePath) { - // super(domain, applicationRootDirectory, baseUrl, online, runtimeId); - super(URI.create("sca://domain/local"), null, null, false, "simple"); - if (classLoader != null) { - this.classLoader = classLoader; - } else { - classLoader = Thread.currentThread().getContextClassLoader(); - } - this.compositePath = compositePath != null ? compositePath : APPLICATION_SCDL; - getApplicationSCDL(); - this.contributionURI = URI.create("/default"); - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public String getCompositePath() { - return compositePath; - } - - public final URL getApplicationSCDL() { - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(compositePath); - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(APPLICATION_SCDL); - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(META_APPLICATION_SCDL); - if (applicationSCDL != null) { - compositePath = META_APPLICATION_SCDL; - } - } else { - if (compositePath == null) { - compositePath = APPLICATION_SCDL; - } - } - if (applicationSCDL == null) { - throw new IllegalArgumentException("application SCDL not found: " + APPLICATION_SCDL); - } - } - } - return applicationSCDL; - } - - public URL getContributionRoot() { - if (contributionURL == null) { - contributionURL = getContributionLocation(getApplicationSCDL(), compositePath); - } - return contributionURL; - } - - public List getExtensionSCDLs() { - if (extensions == null) { - try { - List extensionURLs = new ArrayList(); - Enumeration urls = classLoader.getResources(SERVICE_SCDL); - extensionURLs.addAll(Collections.list(urls)); - urls = classLoader.getResources(EXTENSION_SCDL); - extensionURLs.addAll(Collections.list(urls)); - if (extensions != null) { - for (URL ext : extensions) { - if (!extensionURLs.contains(ext)) { - extensionURLs.add(ext); - } - } - } - extensions = extensionURLs; - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - return extensions; - } - - public URL getSystemSCDL() { - if (systemSCDL == null) { - systemSCDL = classLoader.getResource(SYSTEM_SCDL); - if (systemSCDL == null) { - systemSCDL = classLoader.getResource(DEFAULT_SYSTEM_SCDL); - } - } - return systemSCDL; - } - - private static URL getContributionLocation(URL applicationSCDL, String compositePath) { - URL root = null; - // "jar:file://....../something.jar!/a/b/c/app.composite" - try { - String scdlUrl = applicationSCDL.toExternalForm(); - String protocol = applicationSCDL.getProtocol(); - if ("file".equals(protocol)) { - // directory contribution - if (scdlUrl.endsWith(compositePath)) { - String location = scdlUrl.substring(0, scdlUrl.lastIndexOf(compositePath)); - // workaround from evil url/uri form maven - root = FileHelper.toFile(new URL(location)).toURI().toURL(); - } - - } else if ("jar".equals(protocol)) { - // jar contribution - String location = scdlUrl.substring(4, scdlUrl.lastIndexOf("!/")); - // workaround from evil url/uri form maven - root = FileHelper.toFile(new URL(location)).toURI().toURL(); - } - } catch (MalformedURLException mfe) { - throw new IllegalArgumentException(mfe); - } - - return root; - } - - public URI getContributionURI() { - return contributionURI; - } -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java deleted file mode 100644 index 4eeb30a9c2..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java deleted file mode 100644 index 8b6fe066a6..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - return n1 + n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java deleted file mode 100644 index 37231e53fe..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.api.SCARuntime; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; - -/** - * @version $Rev$ $Date$ - */ -public class CalculatorClient { - - public CalculatorClient() { - super(); - } - - public static void main(String[] args) { - // Start the embedded SCA runtime - SCARuntime.start(); - - // Look up the ComponentContext by name - ComponentContext context = SCARuntime.getComponentContext("CalculatorServiceComponent"); - ServiceReference self = context.createSelfReference(CalculatorService.class); - CalculatorService calculatorService = self.getService(); - System.out.println("1.0 x 2.0 = " + calculatorService.multiply(1.0, 2.0)); - AddService addService = context.getService(AddService.class, "addService"); - System.out.println("1.0 + 2.0 = " + addService.add(1.0, 2.0)); - - // Stop the SCA embedded runtime - SCARuntime.stop(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -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/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 3d861f2018..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Reference; - - -/** - * An implementation of the Calculator service. - */ -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/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java deleted file mode 100644 index 131c5a8014..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java deleted file mode 100644 index f7ac0b7287..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java deleted file mode 100644 index a917896aeb..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index b7dca792b2..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java deleted file mode 100644 index e328f024ea..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 77b128ab8d..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java b/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java deleted file mode 100644 index cacbb7162c..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.api; - -import junit.framework.TestCase; - -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; - -import calculator.AddService; -import calculator.CalculatorService; - -/** - * @version $Rev$ $Date$ - */ -public class SCARuntimeTestCase extends TestCase { - /** - * @throws java.lang.Exception - */ - protected void setUp() throws Exception { - SCARuntime.start(); - } - - public void testStart() throws Exception { - ComponentContext context = SCARuntime.getComponentContext("CalculatorServiceComponent"); - assertNotNull(context); - ServiceReference self = context.createSelfReference(CalculatorService.class); - assertEquals(2.0, self.getService().multiply(1.0, 2.0)); - AddService service = context.getService(AddService.class, "addService"); - assertEquals(3.0, service.add(1.0, 2.0)); - } - - /** - * @throws java.lang.Exception - */ - protected void tearDown() throws Exception { - SCARuntime.stop(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java b/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java deleted file mode 100644 index 1c4b04600d..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.runtime.embedded; - -import java.net.URI; - -import junit.framework.TestCase; - -import org.osoa.sca.ComponentContext; - -import calculator.AddService; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeImplTestCase extends TestCase { - private SimpleRuntime runtime; - - /** - * @throws java.lang.Exception - */ - protected void setUp() throws Exception { - SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(getClass().getClassLoader(), "application.composite"); - runtime = new SimpleRuntimeImpl(runtimeInfo); - runtime.start(); - } - - public void testStart() throws Exception { - ComponentContext context = runtime.getComponentContext(URI - .create("sca://root.application/default/CalculatorServiceComponent")); - assertNotNull(context); - AddService service = context.getService(AddService.class, "addService"); - assertEquals(3.0, service.add(1.0, 2.0)); - } - - /** - * @throws java.lang.Exception - */ - protected void tearDown() throws Exception { - runtime.destroy(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite b/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite deleted file mode 100644 index 55d4ca889b..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite b/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite deleted file mode 100644 index 3974e06dd1..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .m2/repository - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/.classpath b/sandbox/rfeng/samples.M2/creditws-axis2/.classpath deleted file mode 100644 index f505a311e9..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/.classpath +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/.project b/sandbox/rfeng/samples.M2/creditws-axis2/.project deleted file mode 100644 index 9ddadde0d1..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - sample-creditws-axis2 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/build.xml b/sandbox/rfeng/samples.M2/creditws-axis2/build.xml deleted file mode 100644 index 82852e02de..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/build.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/build/lib/CreditCheckService.aar b/sandbox/rfeng/samples.M2/creditws-axis2/build/lib/CreditCheckService.aar deleted file mode 100644 index 8515a8d835..0000000000 Binary files a/sandbox/rfeng/samples.M2/creditws-axis2/build/lib/CreditCheckService.aar and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/resources/CreditCheckService.wsdl b/sandbox/rfeng/samples.M2/creditws-axis2/resources/CreditCheckService.wsdl deleted file mode 100644 index 2b488cca41..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/resources/CreditCheckService.wsdl +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/resources/services.xml b/sandbox/rfeng/samples.M2/creditws-axis2/resources/services.xml deleted file mode 100644 index f883fbdd1d..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/resources/services.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -credit.CreditCheckServiceSkeleton - -http://credit/CreditCheck/getCreditScoreRequest -http://credit/CreditCheck/getCreditScoreResponse - - - diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceMessageReceiverInOut.java b/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceMessageReceiverInOut.java deleted file mode 100644 index 498351f85d..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceMessageReceiverInOut.java +++ /dev/null @@ -1,144 +0,0 @@ - -/** - * CreditCheckServiceMessageReceiverInOut.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: 1.1-RC2 Nov 02, 2006 (02:37:50 LKT) - */ -package credit; - -/** - * CreditCheckServiceMessageReceiverInOut message receiver - */ - -public class CreditCheckServiceMessageReceiverInOut extends - org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver { - - public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, - org.apache.axis2.context.MessageContext newMsgContext) - throws org.apache.axis2.AxisFault { - - try { - - // get the implementation class for the Web Service - Object obj = getTheImplementationObject(msgContext); - - CreditCheckServiceSkeleton skel = (CreditCheckServiceSkeleton)obj; - // Out Envelop - org.apache.axiom.soap.SOAPEnvelope envelope = null; - // Find the axisOperation that has been set by the Dispatch phase. - org.apache.axis2.description.AxisOperation op = - msgContext.getOperationContext().getAxisOperation(); - if (op == null) { - throw new org.apache.axis2.AxisFault( - "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); - } - - java.lang.String methodName; - if (op.getName() != null & (methodName = op.getName().getLocalPart()) != null) { - - if ("getCreditScore".equals(methodName)) { - - credit.GetCreditScoreResponse param11 = null; - - // doc style - credit.GetCreditScore wrappedParam = - (credit.GetCreditScore)fromOM(msgContext.getEnvelope().getBody().getFirstElement(), - credit.GetCreditScore.class, - getEnvelopeNamespaces(msgContext.getEnvelope())); - - param11 = skel.getCreditScore(wrappedParam); - - envelope = toEnvelope(getSOAPFactory(msgContext), param11, false); - - } - - newMsgContext.setEnvelope(envelope); - } - } catch (Exception e) { - throw org.apache.axis2.AxisFault.makeFault(e); - } - } - - // - private org.apache.axiom.om.OMElement toOM(credit.GetCreditScore param, boolean optimizeContent) { - - return param.getOMElement(credit.GetCreditScore.MY_QNAME, org.apache.axiom.om.OMAbstractFactory - .getOMFactory()); - - } - - private org.apache.axiom.om.OMElement toOM(credit.GetCreditScoreResponse param, boolean optimizeContent) { - - return param.getOMElement(credit.GetCreditScoreResponse.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory()); - - } - - private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, - credit.GetCreditScoreResponse param, - boolean optimizeContent) { - org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); - - emptyEnvelope.getBody().addChild(param.getOMElement(credit.GetCreditScoreResponse.MY_QNAME, factory)); - - return emptyEnvelope; - } - - /** - * get the default envelope - */ - private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory) { - return factory.getDefaultEnvelope(); - } - - private java.lang.Object fromOM(org.apache.axiom.om.OMElement param, - java.lang.Class type, - java.util.Map extraNamespaces) { - - try { - - if (credit.GetCreditScore.class.equals(type)) { - - return credit.GetCreditScore.Factory.parse(param.getXMLStreamReaderWithoutCaching()); - - } - - if (credit.GetCreditScoreResponse.class.equals(type)) { - - return credit.GetCreditScoreResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); - - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - return null; - } - - /** - * A utility method that copies the namepaces from the SOAPEnvelope - */ - private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env) { - java.util.Map returnMap = new java.util.HashMap(); - java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); - while (namespaceIterator.hasNext()) { - org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace)namespaceIterator.next(); - returnMap.put(ns.getPrefix(), ns.getNamespaceURI()); - } - return returnMap; - } - - private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) { - org.apache.axis2.AxisFault f; - Throwable cause = e.getCause(); - if (cause != null) { - f = new org.apache.axis2.AxisFault(e.getMessage(), cause); - } else { - f = new org.apache.axis2.AxisFault(e.getMessage()); - } - - return f; - } - -}// end of class diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceSkeleton.java b/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceSkeleton.java deleted file mode 100644 index d114baab4e..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/CreditCheckServiceSkeleton.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * CreditCheckServiceSkeleton.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: 1.0 May 05, 2006 (12:31:13 IST) - */ -package credit; - -/** - * CreditCheckServiceSkeleton java skeleton for the axisService - */ -public class CreditCheckServiceSkeleton { - - /** - * Auto generated method signature - * - * @param request - */ - public credit.GetCreditScoreResponse getCreditScore(credit.GetCreditScore request) { - System.out.println("Checking credit for " + request.getSsn()); - GetCreditScoreResponse response = new GetCreditScoreResponse(); - int score = (int)(650 + (Math.random() - 0.5) * 100); - response.setScore(score); - System.out.println("Credit score is " + score); - return response; - - } - -} diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/ExtensionMapper.java b/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/ExtensionMapper.java deleted file mode 100644 index 744fb4c98c..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/ExtensionMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ExtensionMapper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: #axisVersion# #today# - */ - -package credit; - -/** - * ExtensionMapper class - */ - -public class ExtensionMapper { - - public static java.lang.Object getTypeObject(java.lang.String namespaceURI, - java.lang.String typeName, - javax.xml.stream.XMLStreamReader reader) - throws java.lang.Exception { - - throw new java.lang.RuntimeException("Unsupported type " + namespaceURI + " " + typeName); - } - -} diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScore.java b/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScore.java deleted file mode 100644 index 59130c00d7..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScore.java +++ /dev/null @@ -1,301 +0,0 @@ -/** - * GetCreditScore.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: #axisVersion# #today# - */ - -package credit; - -/** - * GetCreditScore bean class - */ - -public class GetCreditScore implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = - new javax.xml.namespace.QName("http://credit", "getCreditScore", "ns1"); - - /** - * field for Ssn - */ - - protected java.lang.String localSsn; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String getSsn() { - return localSsn; - } - - /** - * Auto generated setter method - * - * @param param Ssn - */ - public void setSsn(java.lang.String param) { - - this.localSsn = param; - - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory) { - - org.apache.axiom.om.OMDataSource dataSource = - new org.apache.axis2.databinding.ADBDataSource(this, parentQName) { - - public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - - java.lang.String prefix = parentQName.getPrefix(); - java.lang.String namespace = parentQName.getNamespaceURI(); - - if (namespace != null) { - java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); - if (writerPrefix != null) { - xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); - } else { - if (prefix == null) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - } else { - xmlWriter.writeStartElement(parentQName.getLocalPart()); - } - - namespace = "http://credit"; - if (!namespace.equals("")) { - prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - - xmlWriter.writeStartElement(prefix, "ssn", namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } else { - xmlWriter.writeStartElement(namespace, "ssn"); - } - - } else { - xmlWriter.writeStartElement("ssn"); - } - - if (localSsn == null) { - // write the nil attribute - - throw new RuntimeException("ssn cannot be null!!"); - - } else { - - xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil - .convertToString(localSsn)); - - } - - xmlWriter.writeEndElement(); - - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute(java.lang.String prefix, - java.lang.String namespace, - java.lang.String attName, - java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - if (xmlWriter.getPrefix(namespace) == null) { - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } - - xmlWriter.writeAttribute(namespace, attName, attValue); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute(java.lang.String namespace, - java.lang.String attName, - java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - if (namespace.equals("")) { - xmlWriter.writeAttribute(attName, attValue); - } else { - registerPrefix(xmlWriter, namespace); - xmlWriter.writeAttribute(namespace, attName, attValue); - } - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, - java.lang.String namespace) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = createPrefix(); - - while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { - prefix = createPrefix(); - } - - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - - return prefix; - } - - /** - * Create a prefix - */ - private java.lang.String createPrefix() { - return "ns" + (int)Math.random(); - } - }; - - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(MY_QNAME, factory, dataSource); - - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - elementList.add(new javax.xml.namespace.QName("http://credit", "ssn")); - - if (localSsn != null) { - elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSsn)); - } else { - throw new RuntimeException("ssn cannot be null!!"); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList - .toArray(), attribList.toArray()); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an - * element, the current or next start element starts this object and any - * intervening reader events are ignorable If this object is not an - * element, it is a complex type and the reader is at the event just - * after the outer start element Postcondition: If this object is an - * element, the reader is positioned at its end element If this object - * is a complex type, the reader is positioned at the end element of its - * outer element - */ - public static GetCreditScore parse(javax.xml.stream.XMLStreamReader reader) - throws java.lang.Exception { - GetCreditScore object = new GetCreditScore(); - int event; - try { - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { - java.lang.String fullTypeName = - reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); - if (fullTypeName != null) { - java.lang.String nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); - if (!"getCreditScore".equals(type)) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); - return (GetCreditScore)credit.ExtensionMapper.getTypeObject(nsUri, type, reader); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal - // attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE.equals(reader - .getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); - } catch (java.lang.IllegalArgumentException e) { - isReaderMTOMAware = false; - } - - reader.next(); - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - if (reader.isStartElement() && new javax.xml.namespace.QName("http://credit", "ssn") - .equals(reader.getName())) { - - java.lang.String content = reader.getElementText(); - - object.setSsn(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); - - reader.next(); - - } // End of if for expected property start element - - else { - // A start element we are not expecting indicates an invalid - // parameter was passed - throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName()); - } - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - if (reader.isStartElement()) - // A start element we are not expecting indicates a trailing - // invalid property - throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName()); - - } catch (javax.xml.stream.XMLStreamException e) { - throw new java.lang.Exception(e); - } - - return object; - } - - }// end of factory class - -} diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScoreResponse.java b/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScoreResponse.java deleted file mode 100644 index 5d5981b177..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/src/credit/GetCreditScoreResponse.java +++ /dev/null @@ -1,290 +0,0 @@ -/** - * GetCreditScoreResponse.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: #axisVersion# #today# - */ - -package credit; - -/** - * GetCreditScoreResponse bean class - */ - -public class GetCreditScoreResponse implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = - new javax.xml.namespace.QName("http://credit", "getCreditScoreResponse", "ns1"); - - /** - * field for Score - */ - - protected int localScore; - - /** - * Auto generated getter method - * - * @return int - */ - public int getScore() { - return localScore; - } - - /** - * Auto generated setter method - * - * @param param Score - */ - public void setScore(int param) { - - this.localScore = param; - - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory) { - - org.apache.axiom.om.OMDataSource dataSource = - new org.apache.axis2.databinding.ADBDataSource(this, parentQName) { - - public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - - java.lang.String prefix = parentQName.getPrefix(); - java.lang.String namespace = parentQName.getNamespaceURI(); - - if (namespace != null) { - java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); - if (writerPrefix != null) { - xmlWriter.writeStartElement(namespace, parentQName.getLocalPart()); - } else { - if (prefix == null) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - } else { - xmlWriter.writeStartElement(parentQName.getLocalPart()); - } - - namespace = "http://credit"; - if (!namespace.equals("")) { - prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - - xmlWriter.writeStartElement(prefix, "score", namespace); - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } else { - xmlWriter.writeStartElement(namespace, "score"); - } - - } else { - xmlWriter.writeStartElement("score"); - } - - xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil - .convertToString(localScore)); - - xmlWriter.writeEndElement(); - - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute(java.lang.String prefix, - java.lang.String namespace, - java.lang.String attName, - java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - if (xmlWriter.getPrefix(namespace) == null) { - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - - } - - xmlWriter.writeAttribute(namespace, attName, attValue); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute(java.lang.String namespace, - java.lang.String attName, - java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter) - throws javax.xml.stream.XMLStreamException { - if (namespace.equals("")) { - xmlWriter.writeAttribute(attName, attValue); - } else { - registerPrefix(xmlWriter, namespace); - xmlWriter.writeAttribute(namespace, attName, attValue); - } - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, - java.lang.String namespace) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix(namespace); - - if (prefix == null) { - prefix = createPrefix(); - - while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) { - prefix = createPrefix(); - } - - xmlWriter.writeNamespace(prefix, namespace); - xmlWriter.setPrefix(prefix, namespace); - } - - return prefix; - } - - /** - * Create a prefix - */ - private java.lang.String createPrefix() { - return "ns" + (int)Math.random(); - } - }; - - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(MY_QNAME, factory, dataSource); - - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - elementList.add(new javax.xml.namespace.QName("http://credit", "score")); - - elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localScore)); - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList - .toArray(), attribList.toArray()); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an - * element, the current or next start element starts this object and any - * intervening reader events are ignorable If this object is not an - * element, it is a complex type and the reader is at the event just - * after the outer start element Postcondition: If this object is an - * element, the reader is positioned at its end element If this object - * is a complex type, the reader is positioned at the end element of its - * outer element - */ - public static GetCreditScoreResponse parse(javax.xml.stream.XMLStreamReader reader) - throws java.lang.Exception { - GetCreditScoreResponse object = new GetCreditScoreResponse(); - int event; - try { - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { - java.lang.String fullTypeName = - reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); - if (fullTypeName != null) { - java.lang.String nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); - if (!"getCreditScoreResponse".equals(type)) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); - return (GetCreditScoreResponse)credit.ExtensionMapper.getTypeObject(nsUri, - type, - reader); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal - // attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE.equals(reader - .getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE)); - } catch (java.lang.IllegalArgumentException e) { - isReaderMTOMAware = false; - } - - reader.next(); - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - - if (reader.isStartElement() && new javax.xml.namespace.QName("http://credit", "score") - .equals(reader.getName())) { - - java.lang.String content = reader.getElementText(); - - object.setScore(org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(content)); - - reader.next(); - - } // End of if for expected property start element - - else { - // A start element we are not expecting indicates an invalid - // parameter was passed - throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName()); - } - - while (!reader.isStartElement() && !reader.isEndElement()) - reader.next(); - if (reader.isStartElement()) - // A start element we are not expecting indicates a trailing - // invalid property - throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName()); - - } catch (javax.xml.stream.XMLStreamException e) { - throw new java.lang.Exception(e); - } - - return object; - } - - }// end of factory class - -} diff --git a/sandbox/rfeng/samples.M2/creditws-axis2/wsdl/credit.wsdl b/sandbox/rfeng/samples.M2/creditws-axis2/wsdl/credit.wsdl deleted file mode 100644 index d484a5e90c..0000000000 --- a/sandbox/rfeng/samples.M2/creditws-axis2/wsdl/credit.wsdl +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws/.ruleset b/sandbox/rfeng/samples.M2/creditws/.ruleset deleted file mode 100644 index 2a06794776..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/.ruleset +++ /dev/null @@ -1,172 +0,0 @@ - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws/pom.xml b/sandbox/rfeng/samples.M2/creditws/pom.xml deleted file mode 100644 index a4f46d23da..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - org.apache.tuscany.sca.samples - parent - 1.0-incubator-M2-SNAPSHOT - - 4.0.0 - sample-creditws - war - Tuscany credit Web Service Sample - A sample credit Web Service. - - - axis2 - - - - - - - org.osoa - sca-api-r0.95 - ${scaImplVersion} - compile - - - - - org.apache.tuscany.sca.kernel - tuscany-api - ${scaImplVersion} - compile - - - - - org.apache.tuscany.sca.runtime - webapp - ${scaImplVersion} - runtime - - - - - junit - junit - 3.8.1 - test - - - - - - install - credit - - - org.apache.tuscany.sca.plugins - tuscany-war-plugin - - - tuscany-war - - tuscany-war - - - - - - - false - - - org.apache.tuscany.sca.services.bindings - axis2 - ${scaImplVersion} - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheck.java b/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheck.java deleted file mode 100644 index ec95a60227..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheck.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package credit; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface CreditCheck { - int getCreditScore(String ssn); -} diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheckImpl.java b/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheckImpl.java deleted file mode 100644 index 24747cf993..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/java/credit/CreditCheckImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package credit; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the CreditReportService service - */ -@Scope("MODULE") -@Service(CreditCheck.class) -public class CreditCheckImpl implements CreditCheck { - - public int getCreditScore(String ssn) { - return (int) (700 + (Math.random() - 0.5) * 100); - } -} diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/LICENSE.txt b/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -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/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/NOTICE b/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 11c564eb19..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== 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/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/README.txt b/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services PMC. - -Incubation is required of all newly accepted projects until a further review -indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness or -stability of the code, it does indicate that the project has yet to be fully -endorsed by the ASF. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/resources/wsdl/credit.wsdl b/sandbox/rfeng/samples.M2/creditws/src/main/resources/wsdl/credit.wsdl deleted file mode 100644 index d484a5e90c..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/resources/wsdl/credit.wsdl +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl b/sandbox/rfeng/samples.M2/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl deleted file mode 100644 index 50688615a6..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - http://repo1.maven.org/maven2/,http://people.apache.org/repo/m2-snapshot-repository,http://people.apache.org/repo/m2-incubating-repository/,http://people.apache.org/repo/m1-snapshot-repository/ - - - - - /WEB-INF/tuscany/extensions/ - - diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/default.scdl b/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/default.scdl deleted file mode 100644 index 95d7dbc6de..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/default.scdl +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - CreditCheckServiceComponent - - - - - - - diff --git a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/web.xml b/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 22d4a55a4c..0000000000 --- a/sandbox/rfeng/samples.M2/creditws/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Tuscany Credit Check Web Service Sample - - - org.apache.tuscany.runtime.webapp.TuscanyContextListener - - - - TuscanyServlet - Tuscany Servlet - org.apache.tuscany.runtime.webapp.TuscanyServlet - - - - TuscanyServlet - /services/* - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/pom.xml b/sandbox/rfeng/samples.M2/mortgage/pom.xml deleted file mode 100644 index 809fade52a..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - org.apache.tuscany.sca.samples - parent - 1.0-incubator-M2-SNAPSHOT - - 4.0.0 - sample-mortgage - jar - Tuscany Mortgage Sample - A sample Mortgage application made of several SCA components wired together. - - - - org.osoa - sca-api-r0.95 - - - org.apache.tuscany.sca - test - test - - - org.apache.tuscany.sca.services.containers - javascript - ${scaImplVersion} - runtime - - - org.apache.tuscany.sca.services.bindings - axis2 - ${scaImplVersion} - runtime - - - org.apache.tuscany.sca.services.databinding - databinding-axiom - ${scaImplVersion} - runtime - - - - - install - ${artifactId} - - - org.apache.maven.plugins - maven-jar-plugin - - - - mortgage.MortgageClient - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheck.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheck.java deleted file mode 100644 index c5787b7819..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheck.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Remotable; - -/** - * CreditCheck interface - */ -@Remotable -public interface CreditCheck { - int getCreditScore(String ssn); -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheckImpl.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheckImpl.java deleted file mode 100644 index 86fe88b417..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/CreditCheckImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * A pojo implementation of the CreditCheck service - */ -@Service(CreditCheck.class) -public class CreditCheckImpl implements CreditCheck { - - public int getCreditScore(String ssn) { - return (int) (700 + (Math.random() - 0.5) * 100); - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/Customer.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/Customer.java deleted file mode 100644 index a8b23c6019..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/Customer.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * A simple Customer object - */ -public class Customer { - private String ssn; - private String firstName; - private String lastName; - private double monthlyIncome; - private String state; - - public double getMonthlyIncome() { - return monthlyIncome; - } - - public void setMonthlyIncome(double monthlyIncome) { - this.monthlyIncome = monthlyIncome; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getSsn() { - return ssn; - } - - public void setSsn(String ssn) { - this.ssn = ssn; - } - - public String toString() { - return firstName + " " + lastName + "[" + ssn + "]"; - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuote.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuote.java deleted file mode 100644 index b5bafeb204..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuote.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -public interface InterestRateQuote { - public float getRate(String state, double loanAmount, int termInYears); -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java deleted file mode 100644 index 93054a2491..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -@Service(InterestRateQuote.class) -public class InterestRateQuoteImpl implements InterestRateQuote { - public float getRate(String state, double loanAmount, int termInYears) { - if (termInYears == 5) - return 5.5f; - else - return 6.5f; - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApproval.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApproval.java deleted file mode 100644 index dcdad18496..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApproval.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * Loan Approval interface - */ -public interface LoanApproval { - public boolean approve(Customer customer, double loanAmount, int years); -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApprovalImpl.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApprovalImpl.java deleted file mode 100644 index 12212b61f0..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/LoanApprovalImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the LoanApproval service. - */ -@Scope("MODULE") -@Service(LoanApproval.class) -public class LoanApprovalImpl implements LoanApproval { - - private CreditCheck creditCheck; - private RiskAssessment riskAssessment; - private MortgageCalculator mortgageCalculator; - private InterestRateQuote interestRateQuote; - - private int minimumCreditScore = 650; - - @Property(name = "minimumCreditScore") - public void setMinimumCreditScore(int minimumCreditScore) { - this.minimumCreditScore = minimumCreditScore; - } - - @Reference - public void setCreditCheck(CreditCheck creditCheck) { - this.creditCheck = creditCheck; - } - - @Reference - public void setInterestRateQuote(InterestRateQuote interestRateQuote) { - this.interestRateQuote = interestRateQuote; - } - - @Reference - public void setMortgageCalculator(MortgageCalculator mortgageCalculator) { - this.mortgageCalculator = mortgageCalculator; - } - - @Reference - public void setRiskAssessment(RiskAssessment riskAssessment) { - this.riskAssessment = riskAssessment; - } - - /** - * @see mortgage.LoanApproval#approve(mortgage.Customer, double, int) - */ - public boolean approve(Customer customer, double loanAmount, int years) { - int score = creditCheck.getCreditScore(customer.getSsn()); - if (score < minimumCreditScore) { - return false; - } - float rate = interestRateQuote.getRate(customer.getState(), loanAmount, years); - double monthlyPayment = mortgageCalculator.getMonthlyPayment(loanAmount, years, rate); - double ratio = monthlyPayment/customer.getMonthlyIncome(); - return riskAssessment.assess(score, ratio); - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculator.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculator.java deleted file mode 100644 index cacd8694de..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Remotable; - -/** - * The Mortgage Calculator service interface. - */ -@Remotable -public interface MortgageCalculator { - public double getMonthlyPayment(double principal, int years, float interestRate); -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java deleted file mode 100644 index c89830ca84..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the Calculator service. - */ -@Service(MortgageCalculator.class) -public class MortgageCalculatorImpl implements MortgageCalculator { - - public double getMonthlyPayment(double principal, int years, float interestRate) { - double monthlyRate = interestRate / 12.0 / 100.0; - double p = Math.pow(1 + monthlyRate, years * 12); - double q = p / (p - 1); - double monthlyPayment = principal * monthlyRate * q; - return monthlyPayment; - } - -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageClient.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageClient.java deleted file mode 100644 index d548f638c0..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/MortgageClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.CompositeContext; -import org.osoa.sca.CurrentCompositeContext; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class MortgageClient { - public static void main(String[] args) throws Exception { - - CompositeContext context = CurrentCompositeContext.getContext(); - LoanApproval loanApplication = context.locateService(LoanApproval.class, "LoanApprovalComponent"); - - Customer customer = new Customer(); - customer.setSsn("111-22-3333"); - customer.setFirstName("John"); - customer.setLastName("Smith"); - customer.setMonthlyIncome(5000.0d); - customer.setState("CA"); - - boolean result = loanApplication.approve(customer, 200000d, 30); - System.out.println((result ? "Approved: " : "Rejected: ") + customer); - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessment.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessment.java deleted file mode 100644 index 23c9589e85..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessment.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * Risk Assessment interface - */ -public interface RiskAssessment { - public boolean assess(int creditScore, double ratio); -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java b/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java deleted file mode 100644 index 8144ef2a7d..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * A pojo implementation of RiskAssessment service - */ -@Service(RiskAssessment.class) -public class RiskAssessmentImpl implements RiskAssessment { - public boolean assess(int creditScore, double ratio) { - if (creditScore >= 750) - return ratio < 0.35; - else if (creditScore >= 700) - return ratio < 0.30; - else - return ratio < 0.25; - } -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/LICENSE.txt b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -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/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/NOTICE b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 11c564eb19..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== 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/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default.scdl b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default.scdl deleted file mode 100644 index ff0c75ea9d..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default.scdl +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - 600 - CreditCheckComponent - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorComponent - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default1.scdl b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default1.scdl deleted file mode 100644 index bfb687be5d..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default1.scdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - 600 - CreditCheckReference - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorJSComponent - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default2.scdl b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default2.scdl deleted file mode 100644 index fc8bdeec0b..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/META-INF/sca/default2.scdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - 600 - CreditCheckReference1 - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorJSComponent - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.componentType b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.componentType deleted file mode 100644 index bf7b10e0f7..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.componentType +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.js b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.js deleted file mode 100644 index b25af1d039..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/MortgageCalculator.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -function getMonthlyPayment(principal, years, interestRate) { - var monthlyRate = interestRate / 12.0 / 100.0; - var p = Math.pow(1 + monthlyRate, years * 12); - var q = p / (p - 1); - var monthlyPayment = principal * monthlyRate * q; - return monthlyPayment; -} diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.jpg deleted file mode 100644 index e28ed63cfb..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.png deleted file mode 100644 index 0bfce0078d..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/credit_composite.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.jpg deleted file mode 100644 index 3f00557c7f..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.png deleted file mode 100644 index 9d5f829fe5..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/loan_approval.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.jpg deleted file mode 100644 index 515b6ecde7..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.png deleted file mode 100644 index 4b815a4b82..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly0.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.jpg deleted file mode 100644 index 01a7c55a14..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.png deleted file mode 100644 index 07422c4f45..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly1.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.jpg deleted file mode 100644 index 992c048684..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.png deleted file mode 100644 index 4667956ed0..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_assembly2.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.jpg deleted file mode 100644 index 5021f6a317..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.png deleted file mode 100644 index 1398c50ded..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_composite.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_diagrams.doc b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_diagrams.doc deleted file mode 100644 index 00d45e1084..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_diagrams.doc and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.jpg deleted file mode 100644 index e91c5f1bbd..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.png deleted file mode 100644 index db304a4c28..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package1.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.jpg deleted file mode 100644 index e8c2865e4a..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.png deleted file mode 100644 index 502e538e94..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_package2.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.jpg b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.jpg deleted file mode 100644 index 30a903089c..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.png b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.png deleted file mode 100644 index b8f42ad318..0000000000 Binary files a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/mortgage_scenario.png and /dev/null differ diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/readme.html b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/readme.html deleted file mode 100644 index bee954a198..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/doc/readme.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - -Mortgage Sample - - - -

Mortgage Sample

- -

Overview

- -

The Tuscany Web services client Helloworld sample shows how to -call a remote Web service by wiring an SCA component to a reference -which uses a Web service binding.

- -

Prerequisites

- -

Obtain the following prerequisites and install according to their -documentation.

- - - -

The business scenario

-The "loan approval" application accepts a mortgage request including the -customer's details and the requested loan amount. It first checks the -credit of the customer to make sure the credit score meets the minimum -requirement. The interest rate is determined based on the principal -requested, the term for the loan and the customers home state. It then -uses a mortgage calculator to calculate the ratio by dividing potential -monthly payment by the customer's income. The ratio and credit score are -passed to perform the risk assessment which makes the final decision. -

-

Packaging structure

- - -

Building

- -

To build the sample  issue :

-
-mvn
-
- -

The result after executing is in the target subdirectory the sample-mortgage.jar

- -

Setup

- -

Set up the Tuscany standalone runtime environment using the -following command:

-
-mvn dependency:unpack 
-
- -

After completion there should be a target\distribution subdirectory -created that has the Tuscany standalone runtime.

- -

The Tuscany Web servivces binding requires the Axis2 and SDO -databinding extensions so copy these to the standalone launcher -extensions directory:

-
-copy target\distribution\contrib\axis2-1.0-incubator-M2.jar target\distribution\extensions
-copy target\distribution\contrib\databinding-sdo-1.0-incubator-M2.jar target\distribution\extensions
-
- -

Running

- -

Execute the following command: (cut -and paste to command line)

-
-java -jar target/distribution/bin/launcher.jar target/sample-mortgage.jar
-
- -

Results

- -

The sample when run should simply display to the standard output:
-
-Approved: John Smith[111-22-3333]

- -We have two versions of the CreditCheck web service implementation in this sample application: -
    -
  • a web service developed with Apache axis2 1.1 release. It's packaged as an Axis2 aar. -
  • a SCA component exposed as a web service. It's packaged as a WAR. -
- -

Deploy the Axis2 CreditCheck web service to Tomcat

-
    -
  1. Download the WAR (Web Archive) ditribution from Apache - Axis2 1.1 release download site. -
  2. Copy axis2.war to <tomcat_home>\webapps. -
  3. Start Tomcat so that axis2.war get deployed to - <tomcat_home>\webapps\axis2. -
  4. Copy creditws-axis2\build\lib\CreditCheckService.aar to - <tomcat_home>\webapps\axis2\WEB-INF\services. -
- -

Deploy the CreditComposite to Tomcat

-
    -
  1. Copy credit.war to <tomcat_home>\webapps. -
  2. Start Tomcat so that credit.war get deployed to - <tomcat_home>\webapps\credit. The CreditCheck web serivice will - be up and running. -
- - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/wsdl/credit.wsdl b/sandbox/rfeng/samples.M2/mortgage/src/main/resources/wsdl/credit.wsdl deleted file mode 100644 index 4779f9ab4d..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/main/resources/wsdl/credit.wsdl +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples.M2/mortgage/src/test/java/mortgage/MortgageClientTestCase.java b/sandbox/rfeng/samples.M2/mortgage/src/test/java/mortgage/MortgageClientTestCase.java deleted file mode 100644 index b45885b544..0000000000 --- a/sandbox/rfeng/samples.M2/mortgage/src/test/java/mortgage/MortgageClientTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import mortgage.Customer; -import mortgage.LoanApproval; - -import org.apache.tuscany.test.SCATestCase; -import org.osoa.sca.CompositeContext; -import org.osoa.sca.CurrentCompositeContext; - -/** - * This shows how to test the Calculator service component. - */ -public class MortgageClientTestCase extends SCATestCase { - - private LoanApproval loanApproval; - - protected void setUp() throws Exception { - // version 1: One composite with local components - setApplicationSCDL(LoanApproval.class, "META-INF/sca/default.scdl"); - // version 2: two composites, one for mortgage and the other for credit - // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default1.scdl"); - // version 3: one composite and an external web service for credit - // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default2.scdl"); - ClassLoader classLoader = getClass().getClassLoader(); - addExtension("binding.axis2", classLoader.getResource("META-INF/sca/binding.axis2.scdl")); - addExtension("container.js", classLoader.getResource("META-INF/sca/js.system.scdl")); - super.setUp(); - CompositeContext context = CurrentCompositeContext.getContext(); - loanApproval = context.locateService(LoanApproval.class, "LoanApprovalComponent"); - } - - public void testApprove() throws Exception { - Customer customer = new Customer(); - customer.setSsn("111-22-3333"); - customer.setFirstName("John"); - customer.setLastName("Smith"); - customer.setMonthlyIncome(5000.0d); - customer.setState("CA"); - - boolean approved = loanApproval.approve(customer, 200000d, 30); - System.out.println(approved ? "Approved" : "Rejected"); - } -} diff --git a/sandbox/rfeng/samples/calculatorws/.ruleset b/sandbox/rfeng/samples/calculatorws/.ruleset deleted file mode 100644 index 2a06794776..0000000000 --- a/sandbox/rfeng/samples/calculatorws/.ruleset +++ /dev/null @@ -1,172 +0,0 @@ - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/pom.xml b/sandbox/rfeng/samples/calculatorws/pom.xml deleted file mode 100644 index 067698e01a..0000000000 --- a/sandbox/rfeng/samples/calculatorws/pom.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - org.apache.tuscany.samples.sca - parent - 1.0-incubator-M2-SNAPSHOT - - 4.0.0 - sample-helloworldws - war - Tuscany HelloWorld Web Service Sample - A sample HelloWorld Web Service. - - - axis2 - - - - - org.osoa - sca-api-r0.95 - 1.0-incubator-M2-SNAPSHOT - compile - - - org.apache.tuscany.sca.kernel - tuscany-api - ${pom.version} - compile - - - - commonj - sdo-api-r2.0.1 - 1.0-incubator-M2-SNAPSHOT - compile - - - org.apache.tuscany.sca.kernel - core - ${pom.version} - runtime - - - javax.servlet - servlet-api - 2.4 - provided - - - org.apache.tuscany.sca.services.bindings - axis2 - ${pom.version} - runtime - - - org.apache.tuscany.sca.services.databinding - databinding-axiom - ${pom.version} - runtime - - - org.apache.tuscany.sca.runtime - webapp - ${pom.version} - runtime - - - org.apache.tuscany.sca.runtime - webapp-host - ${pom.version} - runtime - - - org.apache.ws.commons.axiom - axiom-api - 1.1 - compile - - - org.apache.ws.commons.axiom - axiom-impl - 1.1 - runtime - - - junit - junit - 3.8.1 - test - - - - - - calculator - - - org.apache.tuscany.sca.plugins - tuscany-war-plugin - - - tuscany-war - - tuscany-war - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddService.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddService.java deleted file mode 100644 index 4eeb30a9c2..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddServiceImpl.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index da6a530052..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Scope; - -/** - * An implementation of the Add service - */ -@Scope("MODULE") -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - return n1 + n2; - } - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorClient.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index cb4edeac7e..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.CompositeContext; -import org.osoa.sca.CurrentCompositeContext; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate the Calculator service and invoke it. - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - - CompositeContext context = CurrentCompositeContext.getContext(); - CalculatorService calculatorService = - context.locateService(CalculatorService.class, "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)); - - } -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorService.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 5fbd3a3f6b..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Remotable; - - -/** - * The Calculator service interface. - */ -@Remotable -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/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorServiceImpl.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index efb49ead63..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; - - -/** - * An implementation of the Calculator service. - */ -@Scope("MODULE") -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/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideService.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideService.java deleted file mode 100644 index 131c5a8014..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideServiceImpl.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 535298d31d..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Scope; - -/** - * An implementation of the Divide service. - */ -@Scope("MODULE") -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyService.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index a917896aeb..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyServiceImpl.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index e1d491beee..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Scope; - -/** - * An implementation of the Multiply service. - */ -@Scope("MODULE") -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractService.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractService.java deleted file mode 100644 index e328f024ea..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractServiceImpl.java b/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 053f323627..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.osoa.sca.annotations.Scope; - -/** - * An implementation of the subtract service. - */ -@Scope("MODULE") -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/LICENSE.txt b/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -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/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/NOTICE b/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 11c564eb19..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== 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/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/README.txt b/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services PMC. - -Incubation is required of all newly accepted projects until a further review -indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness or -stability of the code, it does indicate that the project has yet to be fully -endorsed by the ASF. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/resources/wsdl/calculator.wsdl b/sandbox/rfeng/samples/calculatorws/src/main/resources/wsdl/calculator.wsdl deleted file mode 100644 index 9f7573160e..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/resources/wsdl/calculator.wsdl +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/sca/default.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/sca/default.scdl deleted file mode 100644 index 29fdcd4715..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/sca/default.scdl +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - CalculatorServiceComponent - - - - - AddServiceComponent - SubtractServiceComponent - MultiplyServiceComponent - DivideServiceComponent - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl deleted file mode 100644 index 852f36e10d..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl deleted file mode 100644 index 0dcd226418..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl deleted file mode 100644 index 8c1c36d466..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl deleted file mode 100644 index 9a15675f9f..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/webapp.scdl b/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/webapp.scdl deleted file mode 100644 index 3111557013..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/META-INF/tuscany/webapp.scdl +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - - - diff --git a/sandbox/rfeng/samples/calculatorws/src/main/webapp/WEB-INF/web.xml b/sandbox/rfeng/samples/calculatorws/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index f97dc95e23..0000000000 --- a/sandbox/rfeng/samples/calculatorws/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - Tuscany HelloWorld Web Service Sample - - - tuscany.systemScdlPath - /META-INF/tuscany/webapp.scdl - - - - tuscany.applicationScdlPath - /META-INF/sca/default.scdl - - - - org.apache.tuscany.runtime.webapp.TuscanyContextListener - - - - TuscanyServlet - Tuscany Servlet - org.apache.tuscany.runtime.webapp.TuscanyServlet - - - - TuscanyServlet - /services/* - - - diff --git a/sandbox/rfeng/samples/creditws/.ruleset b/sandbox/rfeng/samples/creditws/.ruleset deleted file mode 100644 index 2a06794776..0000000000 --- a/sandbox/rfeng/samples/creditws/.ruleset +++ /dev/null @@ -1,172 +0,0 @@ - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/creditws/pom.xml b/sandbox/rfeng/samples/creditws/pom.xml deleted file mode 100644 index 3f4c4b18b2..0000000000 --- a/sandbox/rfeng/samples/creditws/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - org.apache.tuscany.samples.sca - parent - 1.0-incubator-SNAPSHOT - - 4.0.0 - sample-creditws - war - Tuscany credit Web Service Sample - A sample credit Web Service. - - - axis2 - - - - - - - org.osoa - sca-api-r0.95 - ${tuscanyVersion} - compile - - - - - org.apache.tuscany.sca.kernel - tuscany-api - ${tuscanyVersion} - compile - - - - - org.apache.tuscany.sca.runtime - webapp - ${tuscanyVersion} - runtime - - - - - junit - junit - 3.8.1 - test - - - - - - install - credit - - - org.apache.tuscany.sca.plugins - tuscany-war-plugin - ${tuscanyVersion} - - - tuscany-war - - tuscany-war - - - - - - - false - - - org.apache.tuscany.sca.services.bindings - axis2 - ${tuscanyVersion} - - - - - - - diff --git a/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheck.java b/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheck.java deleted file mode 100644 index ec95a60227..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheck.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package credit; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface CreditCheck { - int getCreditScore(String ssn); -} diff --git a/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheckImpl.java b/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheckImpl.java deleted file mode 100644 index 24747cf993..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/java/credit/CreditCheckImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package credit; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the CreditReportService service - */ -@Scope("MODULE") -@Service(CreditCheck.class) -public class CreditCheckImpl implements CreditCheck { - - public int getCreditScore(String ssn) { - return (int) (700 + (Math.random() - 0.5) * 100); - } -} diff --git a/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/LICENSE.txt b/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -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/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/NOTICE b/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 11c564eb19..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== 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/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/README.txt b/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services PMC. - -Incubation is required of all newly accepted projects until a further review -indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness or -stability of the code, it does indicate that the project has yet to be fully -endorsed by the ASF. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/sandbox/rfeng/samples/creditws/src/main/resources/wsdl/credit.wsdl b/sandbox/rfeng/samples/creditws/src/main/resources/wsdl/credit.wsdl deleted file mode 100644 index d484a5e90c..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/resources/wsdl/credit.wsdl +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl b/sandbox/rfeng/samples/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl deleted file mode 100644 index 50688615a6..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/webapp/META-INF/tuscany/webapp.scdl +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - http://repo1.maven.org/maven2/,http://people.apache.org/repo/m2-snapshot-repository,http://people.apache.org/repo/m2-incubating-repository/,http://people.apache.org/repo/m1-snapshot-repository/ - - - - - /WEB-INF/tuscany/extensions/ - - diff --git a/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/default.scdl b/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/default.scdl deleted file mode 100644 index 5f01cb534e..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/default.scdl +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - CreditCheckServiceComponent - - - - - - - diff --git a/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/web.xml b/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 22d4a55a4c..0000000000 --- a/sandbox/rfeng/samples/creditws/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Tuscany Credit Check Web Service Sample - - - org.apache.tuscany.runtime.webapp.TuscanyContextListener - - - - TuscanyServlet - Tuscany Servlet - org.apache.tuscany.runtime.webapp.TuscanyServlet - - - - TuscanyServlet - /services/* - - - diff --git a/sandbox/rfeng/samples/echo.databinding/.ruleset b/sandbox/rfeng/samples/echo.databinding/.ruleset deleted file mode 100644 index 42a6f1be38..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/.ruleset +++ /dev/null @@ -1,190 +0,0 @@ - - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/echo.databinding/NOTICE.txt b/sandbox/rfeng/samples/echo.databinding/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/rfeng/samples/echo.databinding/pom.xml b/sandbox/rfeng/samples/echo.databinding/pom.xml deleted file mode 100644 index c8f7ab71ed..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - org.apache.tuscany.sca - integration-test - 1.0-incubating-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.apache.tuscany.samples.sca - sample-echo-databinding - 1.0-incubating-SNAPSHOT - Echo DataBinding - A Sample for DataBinding - - - - org.osoa - sca-api - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-assembly - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-wsdl - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-databinding - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.0-incubating-SNAPSHOT - runtime - - - - org.apache.ws.commons.axiom - axiom-api - 1.2.2 - compile - - - - org.apache.ws.commons.axiom - axiom-impl - 1.2.2 - runtime - - - org.codehaus.woodstox - wstx-asl - 3.2.0 - runtime - - - junit - junit - 4.2 - test - - - commons-logging - commons-logging - 1.1 - runtime - - - - diff --git a/sandbox/rfeng/samples/echo.databinding/src/main/resources/META-INF/sca/binding.echo.scdl b/sandbox/rfeng/samples/echo.databinding/src/main/resources/META-INF/sca/binding.echo.scdl deleted file mode 100644 index 39f56b48ad..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/main/resources/META-INF/sca/binding.echo.scdl +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentAImpl.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentAImpl.java deleted file mode 100644 index 84466f90d0..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentAImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.apache.axiom.om.OMElement; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentAImpl implements Interface1 { - - private Interface1 componentBReference; - - private String prefix; - - private String prefix1; - - private String bar; - - private OMElement omProperty; - - @Constructor - public ComponentAImpl(@Reference(name = "componentBReference", required = true) - Interface1 componentBReference) { - this.componentBReference = componentBReference; - } - - public Object call(Object msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentA --> Received message: " + request); - Object ret = componentBReference.call(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentA --> Returned message: " + response); - return ret; - } - - public Object call1(Object msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentA --> Received message: " + request); - Object ret = componentBReference.call1(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentA --> Returned message: " + response); - return ret; - } - - @Property(name="prefix") - public void setPrefix(String prefix) { - System.out.println("[Property] prefix: " + prefix); - this.prefix = prefix; - } - - @Property(name="prefix1") - public void setPrefix1(String prefix1) { - System.out.println("[Property] prefix1: " + prefix1); - this.prefix1 = prefix1; - } - - /** - * @param bar the bar to set - */ - @Property(name="bar") - public void setBar(String bar) { - System.out.println("[Property] bar: " + bar); - this.bar = bar; - } - - /** - * @param omProperty the omProperty to set - */ - @Property(name="omProperty") - public void setOmProperty(OMElement omProperty) { - this.omProperty = omProperty; - } - -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentBImpl.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentBImpl.java deleted file mode 100644 index f8783d39e9..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/ComponentBImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import javax.xml.stream.XMLStreamReader; - -import org.osoa.sca.annotations.AllowsPassByReference; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Reference; -import org.w3c.dom.Node; - -/** - * @version $Rev$ $Date$ - */ -@AllowsPassByReference -public class ComponentBImpl implements Interface2 { - - private Echo echoReference; - - @Constructor - public ComponentBImpl(@Reference(name = "echoReference", required = true) - Echo echoReference) { - this.echoReference = echoReference; - } - - public Node call(Node msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentB --> Received message: " + request); - Node ret = (Node) echoReference.echo(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentB --> Returned message: " + response); - return ret; - } - - public XMLStreamReader call1(XMLStreamReader msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentB --> Received message: " + request); -// XMLStreamReader ret = (XMLStreamReader) echoReference.echo(msg); - String response = request; - System.out.println("ComponentB --> Returned message: " + response); - return msg; - } -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/DataBindingITest.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/DataBindingITest.java deleted file mode 100644 index 0be318fe07..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/DataBindingITest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import junit.framework.TestCase; - -import org.apache.tuscany.api.SCARuntime; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; - -/** - * @version $Rev$ $Date$ - */ -public class DataBindingITest extends TestCase { - - @Override - protected void setUp() throws Exception { - SCARuntime.start(); - } - - @Override - protected void tearDown() throws Exception { - SCARuntime.stop(); - } - - protected Interface1 componentA; - - public void testTransform() { - ComponentContext context = SCARuntime.getComponentContext("ComponentA"); - ServiceReference ref = context.createSelfReference(Interface1.class); - componentA = ref.getService(); - componentA.call("123"); - componentA.call1("123"); - } -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Echo.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Echo.java deleted file mode 100644 index 434b7371a8..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Echo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.apache.tuscany.databinding.annotation.DataBinding; -import org.osoa.sca.annotations.Remotable; - -/** - * @version $Rev$ $Date$ - */ -// @DataType(name="org.apache.axiom.om.OMElement") -@DataBinding("org.w3c.dom.Node") -@Remotable -public interface Echo { - Object echo(Object msg); -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface1.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface1.java deleted file mode 100644 index b48213060c..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface1.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.apache.tuscany.databinding.annotation.DataBinding; -import org.osoa.sca.annotations.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@DataBinding("java.lang.String") -@Remotable -public interface Interface1 { - Object call(Object msg); - Object call1(Object msg); -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface2.java b/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface2.java deleted file mode 100644 index 293b613f44..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/java/echo/Interface2.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.databinding.annotation.DataBinding; -import org.osoa.sca.annotations.Remotable; -import org.w3c.dom.Node; - -/** - * @version $Rev$ $Date$ - */ -@DataBinding("org.w3c.dom.Node") -@Remotable -public interface Interface2 { - Node call(Node msg); - @DataBinding("javax.xml.stream.XMLStreamReader") - XMLStreamReader call1(XMLStreamReader msg); -} diff --git a/sandbox/rfeng/samples/echo.databinding/src/test/resources/wsdl/echo.wsdl b/sandbox/rfeng/samples/echo.databinding/src/test/resources/wsdl/echo.wsdl deleted file mode 100644 index 5749bd8aff..0000000000 --- a/sandbox/rfeng/samples/echo.databinding/src/test/resources/wsdl/echo.wsdl +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/rfeng/samples/mortgage/pom.xml b/sandbox/rfeng/samples/mortgage/pom.xml deleted file mode 100644 index f64d39f120..0000000000 --- a/sandbox/rfeng/samples/mortgage/pom.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - org.apache.tuscany.samples.sca - parent - 1.0-incubator-SNAPSHOT - - 4.0.0 - sample-mortgage - jar - Tuscany Mortgage Sample - A sample Mortgage application made of several SCA components wired together. - - - 1.0-incubator-SNAPSHOT - - - - - org.osoa - sca-api-r0.95 - ${tuscanyVersion} - - - org.apache.tuscany.sca - test - ${tuscanyVersion} - test - - - org.apache.tuscany.sca.services.containers - javascript - ${tuscanyVersion} - runtime - - - org.apache.tuscany.sca.services.bindings - axis2 - ${tuscanyVersion} - runtime - - - org.apache.tuscany.sca.services.databinding - databinding-axiom - ${tuscanyVersion} - runtime - - - org.apache.tuscany.samples.sca - sample-creditws - ${tuscanyVersion} - war - provided - - - - - install - ${artifactId} - - - org.apache.maven.plugins - maven-jar-plugin - - - - mortgage.MortgageClient - - - - - - org.codehaus.cargo - cargo-maven2-plugin - - - start-container - pre-integration-test - - start - - - - stop-container - post-integration-test - - stop - - - - - - false - - - - tomcat5x - C:/Apache/apache-tomcat-5.5.20 - - - - - - - ${project.build.directory}/tomcat5x - - - org.apache.tuscany.samples.sca - sample-creditws - war - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheck.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheck.java deleted file mode 100644 index c5787b7819..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheck.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Remotable; - -/** - * CreditCheck interface - */ -@Remotable -public interface CreditCheck { - int getCreditScore(String ssn); -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheckImpl.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheckImpl.java deleted file mode 100644 index 86fe88b417..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/CreditCheckImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * A pojo implementation of the CreditCheck service - */ -@Service(CreditCheck.class) -public class CreditCheckImpl implements CreditCheck { - - public int getCreditScore(String ssn) { - return (int) (700 + (Math.random() - 0.5) * 100); - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/Customer.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/Customer.java deleted file mode 100644 index a8b23c6019..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/Customer.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * A simple Customer object - */ -public class Customer { - private String ssn; - private String firstName; - private String lastName; - private double monthlyIncome; - private String state; - - public double getMonthlyIncome() { - return monthlyIncome; - } - - public void setMonthlyIncome(double monthlyIncome) { - this.monthlyIncome = monthlyIncome; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getSsn() { - return ssn; - } - - public void setSsn(String ssn) { - this.ssn = ssn; - } - - public String toString() { - return firstName + " " + lastName + "[" + ssn + "]"; - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuote.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuote.java deleted file mode 100644 index b5bafeb204..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuote.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -public interface InterestRateQuote { - public float getRate(String state, double loanAmount, int termInYears); -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java deleted file mode 100644 index 93054a2491..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/InterestRateQuoteImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -@Service(InterestRateQuote.class) -public class InterestRateQuoteImpl implements InterestRateQuote { - public float getRate(String state, double loanAmount, int termInYears) { - if (termInYears == 5) - return 5.5f; - else - return 6.5f; - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApproval.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApproval.java deleted file mode 100644 index dcdad18496..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApproval.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * Loan Approval interface - */ -public interface LoanApproval { - public boolean approve(Customer customer, double loanAmount, int years); -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApprovalImpl.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApprovalImpl.java deleted file mode 100644 index 0283e5826d..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/LoanApprovalImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the LoanApproval service. - */ -@Service(LoanApproval.class) // Service declaration -public class LoanApprovalImpl implements LoanApproval { - private CreditCheck[] creditCheck; - private MortgageCalculator mortgageCalculator; - private InterestRateQuote interestRateQuote; - - // Reference declaration using a protected or public field - @Reference - public RiskAssessment riskAssessment; - - private int minimumCreditScore = 650; - - // Property declaration using a setter method - @Property(name = "minimumCreditScore", override = "may") - public void setMinimumCreditScore(int minimumCreditScore) { - this.minimumCreditScore = minimumCreditScore; - } - - // Reference declaration using a setter method - @Reference - public void setCreditCheck(CreditCheck[] creditCheck) { - this.creditCheck = creditCheck; - } - - @Reference - public void setInterestRateQuote(InterestRateQuote interestRateQuote) { - this.interestRateQuote = interestRateQuote; - } - - @Reference - public void setMortgageCalculator(MortgageCalculator mortgageCalculator) { - this.mortgageCalculator = mortgageCalculator; - } - - public boolean approve(Customer customer, double loanAmount, int years) { - int score = creditCheck[0].getCreditScore(customer.getSsn()); - if (score < minimumCreditScore) { - return false; - } - float rate = interestRateQuote.getRate(customer.getState(), loanAmount, years); - double monthlyPayment = mortgageCalculator.getMonthlyPayment(loanAmount, years, rate); - double ratio = monthlyPayment / customer.getMonthlyIncome(); - return riskAssessment.assess(score, ratio); - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculator.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculator.java deleted file mode 100644 index cacd8694de..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Remotable; - -/** - * The Mortgage Calculator service interface. - */ -@Remotable -public interface MortgageCalculator { - public double getMonthlyPayment(double principal, int years, float interestRate); -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java deleted file mode 100644 index c89830ca84..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageCalculatorImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * An implementation of the Calculator service. - */ -@Service(MortgageCalculator.class) -public class MortgageCalculatorImpl implements MortgageCalculator { - - public double getMonthlyPayment(double principal, int years, float interestRate) { - double monthlyRate = interestRate / 12.0 / 100.0; - double p = Math.pow(1 + monthlyRate, years * 12); - double q = p / (p - 1); - double monthlyPayment = principal * monthlyRate * q; - return monthlyPayment; - } - -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageClient.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageClient.java deleted file mode 100644 index 7e89ffeab6..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/MortgageClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import org.osoa.sca.CompositeContext; -import org.osoa.sca.CurrentCompositeContext; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class MortgageClient { - public static void main(String[] args) throws Exception { - - // Locate the service using SCA APIs - CompositeContext context = CurrentCompositeContext.getContext(); - LoanApproval loanApplication = context.locateService(LoanApproval.class, "LoanApprovalComponent"); - - // Create the customer - Customer customer = new Customer(); - customer.setSsn("111-22-3333"); - customer.setFirstName("John"); - customer.setLastName("Smith"); - customer.setMonthlyIncome(5000.0d); - customer.setState("CA"); - - // Invoke the service - boolean result = loanApplication.approve(customer, 200000d, 30); - System.out.println((result ? "Approved: " : "Rejected: ") + customer); - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessment.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessment.java deleted file mode 100644 index 23c9589e85..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessment.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -/** - * Risk Assessment interface - */ -public interface RiskAssessment { - public boolean assess(int creditScore, double ratio); -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java b/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java deleted file mode 100644 index 8144ef2a7d..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/java/mortgage/RiskAssessmentImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package mortgage; - -import org.osoa.sca.annotations.Service; - -/** - * A pojo implementation of RiskAssessment service - */ -@Service(RiskAssessment.class) -public class RiskAssessmentImpl implements RiskAssessment { - public boolean assess(int creditScore, double ratio) { - if (creditScore >= 750) - return ratio < 0.35; - else if (creditScore >= 700) - return ratio < 0.30; - else - return ratio < 0.25; - } -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/LICENSE.txt b/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -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/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/NOTICE b/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 11c564eb19..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== 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/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl b/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl deleted file mode 100644 index e44911c13c..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - 600 - CreditCheckComponent - CreditCheckComponent - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorComponent - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default1.scdl b/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default1.scdl deleted file mode 100644 index bfb687be5d..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default1.scdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - 600 - CreditCheckReference - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorJSComponent - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default2.scdl b/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default2.scdl deleted file mode 100644 index fc8bdeec0b..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default2.scdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - 600 - CreditCheckReference1 - InterestRateQuoteComponent - RiskAssessmentComponent - MortgageCalculatorJSComponent - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType b/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType deleted file mode 100644 index bf7b10e0f7..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js b/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js deleted file mode 100644 index b25af1d039..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -function getMonthlyPayment(principal, years, interestRate) { - var monthlyRate = interestRate / 12.0 / 100.0; - var p = Math.pow(1 + monthlyRate, years * 12); - var q = p / (p - 1); - var monthlyPayment = principal * monthlyRate * q; - return monthlyPayment; -} diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.jpg deleted file mode 100644 index e28ed63cfb..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.png deleted file mode 100644 index 0bfce0078d..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/credit_composite.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.jpg deleted file mode 100644 index 3f00557c7f..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.png deleted file mode 100644 index 9d5f829fe5..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/loan_approval.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.jpg deleted file mode 100644 index 515b6ecde7..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.png deleted file mode 100644 index 4b815a4b82..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly0.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.jpg deleted file mode 100644 index 01a7c55a14..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.png deleted file mode 100644 index 07422c4f45..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly1.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.jpg deleted file mode 100644 index 992c048684..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.png deleted file mode 100644 index 4667956ed0..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_assembly2.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.jpg deleted file mode 100644 index 5021f6a317..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.png deleted file mode 100644 index 1398c50ded..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_composite.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_diagrams.doc b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_diagrams.doc deleted file mode 100644 index 00d45e1084..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_diagrams.doc and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.jpg deleted file mode 100644 index e91c5f1bbd..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.png deleted file mode 100644 index db304a4c28..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package1.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.jpg deleted file mode 100644 index e8c2865e4a..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.png deleted file mode 100644 index 502e538e94..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_package2.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.jpg b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.jpg deleted file mode 100644 index fccf2e35c3..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.jpg and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.png b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.png deleted file mode 100644 index b8f42ad318..0000000000 Binary files a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/mortgage_scenario.png and /dev/null differ diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/readme.html b/sandbox/rfeng/samples/mortgage/src/main/resources/doc/readme.html deleted file mode 100644 index bee954a198..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/doc/readme.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - -Mortgage Sample - - - -

Mortgage Sample

- -

Overview

- -

The Tuscany Web services client Helloworld sample shows how to -call a remote Web service by wiring an SCA component to a reference -which uses a Web service binding.

- -

Prerequisites

- -

Obtain the following prerequisites and install according to their -documentation.

- - - -

The business scenario

-The "loan approval" application accepts a mortgage request including the -customer's details and the requested loan amount. It first checks the -credit of the customer to make sure the credit score meets the minimum -requirement. The interest rate is determined based on the principal -requested, the term for the loan and the customers home state. It then -uses a mortgage calculator to calculate the ratio by dividing potential -monthly payment by the customer's income. The ratio and credit score are -passed to perform the risk assessment which makes the final decision. -

-

Packaging structure

- - -

Building

- -

To build the sample  issue :

-
-mvn
-
- -

The result after executing is in the target subdirectory the sample-mortgage.jar

- -

Setup

- -

Set up the Tuscany standalone runtime environment using the -following command:

-
-mvn dependency:unpack 
-
- -

After completion there should be a target\distribution subdirectory -created that has the Tuscany standalone runtime.

- -

The Tuscany Web servivces binding requires the Axis2 and SDO -databinding extensions so copy these to the standalone launcher -extensions directory:

-
-copy target\distribution\contrib\axis2-1.0-incubator-M2.jar target\distribution\extensions
-copy target\distribution\contrib\databinding-sdo-1.0-incubator-M2.jar target\distribution\extensions
-
- -

Running

- -

Execute the following command: (cut -and paste to command line)

-
-java -jar target/distribution/bin/launcher.jar target/sample-mortgage.jar
-
- -

Results

- -

The sample when run should simply display to the standard output:
-
-Approved: John Smith[111-22-3333]

- -We have two versions of the CreditCheck web service implementation in this sample application: -
    -
  • a web service developed with Apache axis2 1.1 release. It's packaged as an Axis2 aar. -
  • a SCA component exposed as a web service. It's packaged as a WAR. -
- -

Deploy the Axis2 CreditCheck web service to Tomcat

-
    -
  1. Download the WAR (Web Archive) ditribution from Apache - Axis2 1.1 release download site. -
  2. Copy axis2.war to <tomcat_home>\webapps. -
  3. Start Tomcat so that axis2.war get deployed to - <tomcat_home>\webapps\axis2. -
  4. Copy creditws-axis2\build\lib\CreditCheckService.aar to - <tomcat_home>\webapps\axis2\WEB-INF\services. -
- -

Deploy the CreditComposite to Tomcat

-
    -
  1. Copy credit.war to <tomcat_home>\webapps. -
  2. Start Tomcat so that credit.war get deployed to - <tomcat_home>\webapps\credit. The CreditCheck web serivice will - be up and running. -
- - - diff --git a/sandbox/rfeng/samples/mortgage/src/main/resources/wsdl/credit.wsdl b/sandbox/rfeng/samples/mortgage/src/main/resources/wsdl/credit.wsdl deleted file mode 100644 index 4779f9ab4d..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/main/resources/wsdl/credit.wsdl +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java b/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java deleted file mode 100644 index b30df0cf2d..0000000000 --- a/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package mortgage; - -import mortgage.Customer; -import mortgage.LoanApproval; - -import org.apache.tuscany.test.SCATestCase; -import org.osoa.sca.CompositeContext; -import org.osoa.sca.CurrentCompositeContext; - -/** - * This shows how to test the Calculator service component. - */ -public class MortgageClientTestCase extends SCATestCase { - - private LoanApproval loanApproval; - - protected void setUp() throws Exception { - // version 1: One composite with local components - setApplicationSCDL(LoanApproval.class, "META-INF/sca/default.scdl"); - // version 2: two composites, one for mortgage and the other for credit - // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default1.scdl"); - // version 3: one composite and an external web service for credit - // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default2.scdl"); - ClassLoader classLoader = getClass().getClassLoader(); - // addExtension("binding.axis2", classLoader.getResource("META-INF/sca/binding.axis2.scdl")); - // addExtension("container.js", classLoader.getResource("META-INF/sca/js.system.scdl")); - super.setUp(); - CompositeContext context = CurrentCompositeContext.getContext(); - loanApproval = context.locateService(LoanApproval.class, "LoanApprovalComponent"); - } - - public void testApprove() throws Exception { - Customer customer = new Customer(); - customer.setSsn("111-22-3333"); - customer.setFirstName("John"); - customer.setLastName("Smith"); - customer.setMonthlyIncome(5000.0d); - customer.setState("CA"); - - boolean approved = loanApproval.approve(customer, 200000d, 30); - System.out.println((approved ? "Approved: " : "Rejected: ") + customer); - } -} diff --git a/sandbox/rfeng/samples/pom.xml b/sandbox/rfeng/samples/pom.xml deleted file mode 100644 index 18ec781b20..0000000000 --- a/sandbox/rfeng/samples/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 4.0.0 - org.apache.tuscany.samples.sca - rfeng - pom - Tuscany SCA Samples - 1.0-incubator-SNAPSHOT - - - creditws - mortgage - helloworld - helloworldws - - - - install - - - \ No newline at end of file -- cgit v1.2.3