summaryrefslogtreecommitdiffstats
path: root/sandbox/old
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/old
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/old')
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/.checkstyle6
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/.pmd2
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/.ruleset190
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/README.txt35
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/pom.xml.off96
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java35
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java65
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java100
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java245
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java77
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java281
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java43
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java43
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java89
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java90
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java197
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java205
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java322
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java30
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java83
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java81
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl31
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java35
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java134
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java152
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java32
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java33
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl181
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl136
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl163
-rw-r--r--sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml288
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off70
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm141
-rwxr-xr-xsandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat10
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml35
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java47
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java28
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl41
-rw-r--r--sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl77
-rw-r--r--sandbox/old/contrib/binding-celtix/sunjars/build.xml56
-rw-r--r--sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off102
-rwxr-xr-xsandbox/old/contrib/binding-hessian/binding/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/binding-hessian/binding/pom.xml.off35
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java42
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java39
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java39
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java51
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java36
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java46
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java67
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java28
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java32
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java220
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java78
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java112
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java32
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java115
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java71
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java35
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java73
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java28
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java38
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java38
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java58
-rw-r--r--sandbox/old/contrib/binding-hessian/binding/src/test/java/org/apache/tuscany/hessian/integration/HessianLocalSendReceiveTestCase.java68
-rw-r--r--sandbox/old/contrib/binding-hessian/pom.xml.off103
-rw-r--r--sandbox/old/contrib/binding-jms/DISCLAIMER8
-rw-r--r--sandbox/old/contrib/binding-jms/LICENSE205
-rw-r--r--sandbox/old/contrib/binding-jms/NOTICE6
-rw-r--r--sandbox/old/contrib/binding-jms/pom.xml33
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java162
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java177
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java257
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java40
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java199
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java131
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java75
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java38
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java100
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java119
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java49
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java114
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java100
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java68
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java67
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java71
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java70
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl52
-rw-r--r--sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl52
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java26
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java27
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java26
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java27
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroService.java23
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java36
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java110
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java112
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java89
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java64
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/resources/META-INF/sca/default.scdl61
-rw-r--r--sandbox/old/contrib/binding-jms/src/test/resources/wsdl/helloworld.wsdl130
-rw-r--r--sandbox/old/contrib/binding-osgi/.pmd2
-rw-r--r--sandbox/old/contrib/binding-osgi/.ruleset190
-rwxr-xr-xsandbox/old/contrib/binding-osgi/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/binding-osgi/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/binding-osgi/README.txt35
-rw-r--r--sandbox/old/contrib/binding-osgi/pom.xml.off91
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/LauncherActivator.java79
-rw-r--r--sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGILauncherInitException.java31
-rw-r--r--sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGiHost.java32
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteMethodException.java34
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteServiceException.java39
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingBuilder.java69
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingDefinition.java45
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingException.java39
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingLoader.java66
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiInvoker.java79
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java65
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java116
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/BundleContextUtil.java93
-rw-r--r--sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/ClassloaderHook.java64
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/resources/META-INF/MANIFEST.MF14
-rwxr-xr-xsandbox/old/contrib/binding-osgi/src/main/resources/META-INF/sca/osgibinding.scdl38
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/pom.xml.off60
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java169
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaComponent.java43
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaDeployer.java60
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java157
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java30
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java113
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java33
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java85
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java44
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java166
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java151
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java70
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java169
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java30
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java30
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java94
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java110
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java75
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java125
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java90
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java174
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBinding.java47
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBindingLoader.java63
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixBuilder.java57
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixInvoker.java77
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixReference.java54
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixService.java42
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/DISCLAIMER6
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/LICENSE203
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/NOTICE11
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java74
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java110
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java43
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java45
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java27
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java93
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java68
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataService.java28
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataServiceImpl.java50
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/CheckingAccount.java41
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/SavingsAccount.java41
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/StockAccount.java50
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteRequest.java43
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteResponse.java43
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteService.java29
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j-tests.properties21
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j.properties21
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/account/AccountService.wsdl80
-rw-r--r--sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/sca.module56
-rw-r--r--sandbox/old/contrib/databinding-castor/.ruleset172
-rwxr-xr-xsandbox/old/contrib/databinding-castor/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/databinding-castor/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/databinding-castor/pom.xml.off120
-rwxr-xr-xsandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Node.java63
-rw-r--r--sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2SAX.java63
-rw-r--r--sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Writer.java62
-rw-r--r--sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/InputSource2Castor.java63
-rw-r--r--sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Node2Castor.java63
-rw-r--r--sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Reader2Castor.java64
-rw-r--r--sandbox/old/contrib/databinding-castor/src/test/java/org/apache/tuscany/databinding/castor/Castor2NodeTestCase.java69
-rwxr-xr-xsandbox/old/contrib/databinding-castor/src/test/resources/binding.xml9
-rwxr-xr-xsandbox/old/contrib/databinding-castor/src/test/resources/ipo.xsd118
-rw-r--r--sandbox/old/contrib/databinding-castor/src/test/resources/org/exolab/castor/builder/castorbuilder.properties67
-rw-r--r--sandbox/old/contrib/databinding-json/.ruleset172
-rw-r--r--sandbox/old/contrib/databinding-json/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/databinding-json/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/databinding-json/pom.xml.off70
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java62
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java52
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java69
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java272
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java83
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java56
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java174
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl43
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/default.scdl22
-rw-r--r--sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sandbox/old/contrib/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java88
-rw-r--r--sandbox/old/contrib/databinding-json/src/test/resources/ipo.xsd118
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/.ruleset172
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/pom.xml.off96
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java56
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java35
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java56
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java52
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java47
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl43
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl22
-rw-r--r--sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite22
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java99
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsd118
-rwxr-xr-xsandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsdconfig21
-rw-r--r--sandbox/old/contrib/discovery-jms/DISCLAIMER8
-rw-r--r--sandbox/old/contrib/discovery-jms/LICENSE205
-rw-r--r--sandbox/old/contrib/discovery-jms/NOTICE6
-rw-r--r--sandbox/old/contrib/discovery-jms/pom.xml73
-rw-r--r--sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/JmsDiscoveryService.java175
-rw-r--r--sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyJmsException.java37
-rw-r--r--sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyMessageListener.java86
-rw-r--r--sandbox/old/contrib/discovery/bonjour/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/discovery/bonjour/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/discovery/bonjour/pom.xml.off43
-rw-r--r--sandbox/old/contrib/discovery/bonjour/src/main/java/org/apache/tuscany/service/discovery/bonjour/BonjourDiscoveryService.java60
-rw-r--r--sandbox/old/contrib/discovery/installjxta/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/discovery/installjxta/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/discovery/installjxta/build.xml56
-rw-r--r--sandbox/old/contrib/discovery/installjxta/pom.xml.off58
-rw-r--r--sandbox/old/contrib/discovery/jxta/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/discovery/jxta/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/discovery/jxta/pom.xml.off74
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryService.java320
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaException.java48
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/pdp/PeerListener.java125
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java122
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl42
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java146
-rw-r--r--sandbox/old/contrib/discovery/jxta/src/test/resources/test.scdl34
-rw-r--r--sandbox/old/contrib/discovery/pom.xml.off37
-rw-r--r--sandbox/old/contrib/host-equinox/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/host-equinox/pom.xml.off61
-rw-r--r--sandbox/old/contrib/host-equinox/src/test/java/org/apache/tuscany/equinox/EquinoxStartTestCase.java42
-rw-r--r--sandbox/old/contrib/implementation-bpel/container/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-bpel/container/pom.xml.off61
-rw-r--r--sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/bpel.system.scdl40
-rw-r--r--sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/default.scdl40
-rw-r--r--sandbox/old/contrib/implementation-bsf/.ruleset190
-rwxr-xr-xsandbox/old/contrib/implementation-bsf/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/implementation-bsf/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-bsf/pom.xml.off82
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ComponentConfiguration.java127
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/MissingSideFileException.java32
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java73
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java98
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java46
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java75
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java92
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java122
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java31
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java133
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceImpl.java47
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java56
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/WireObjectFactory.java50
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/default.scdl40
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/script.system.scdl40
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java118
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java90
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java111
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java34
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java78
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java132
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java35
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java106
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceImplTestCase.java46
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java78
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java27
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType9
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock1
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType9
-rw-r--r--sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock1
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/.ruleset190
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/pom.xml.off63
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java96
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java110
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentType.java47
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoader.java73
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyConfiguration.java149
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyImplementation.java73
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java87
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/ImplementationLoader.java108
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/default.scdl46
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/groovy.system.scdl46
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java79
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoaderTestCase.java39
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ImplementationLoaderTestCase.java102
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java96
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java82
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java206
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/AsyncTarget.java27
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/Greeting.java25
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/resources/Foo.groovy15
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-groovy/container/src/test/resources/org/apache/tuscany/container/groovy/mock/TestScript.groovy1
-rw-r--r--sandbox/old/contrib/implementation-groovy/pom.xml.off39
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/pom.xml.off64
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java34
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldService.java26
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.componentType26
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.groovy25
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/NOTICE18
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java47
-rw-r--r--sandbox/old/contrib/implementation-groovy/samples/pom.xml.off102
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/pom.xml.off97
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java100
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java142
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentType.java33
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java112
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java38
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java111
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptIntrospector.java174
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java65
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptRefInvocInterceptor.java132
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptReferenceProxy.java132
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java123
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfig.java157
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java210
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java110
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsHandler.java28
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsProcessor.java79
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/TuscanySampleXmlUtil.java1097
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XBbasedXMLGenerator.java253
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGenerator.java52
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGeneratorFactory.java55
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDConfiguration.java246
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGenerator.java82
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceCreationException.java34
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistry.java31
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistryImpl.java67
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/default.scdl51
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/js.system.scdl51
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldService.java27
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldServiceImpl.java55
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoaderTestCase.java107
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/PropertyTestCase.java56
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/RhinoScriptIntrospectorTestCase.java114
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/ScriptInvokeTestCase.java54
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/WireTestCase.java166
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/HelloWorldTestCase.java104
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/ScopeTestCase.java65
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/mock/Greeting.java26
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/Foo.java34
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvokerTestCase.java174
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfigTestCase.java116
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstanceTestCase.java50
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptTestCase.java83
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGeneratorTestCase.java129
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/AccountService.wsdl242
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/interopdoc.wsdl180
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.componentType26
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.js21
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/IntrospectableHelloWorld.js25
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/compositeScope.js29
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.componentType33
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.js45
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/helloworld.scdl50
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.componentType28
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.js21
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/requestScope.js30
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/scopeTest.scdl37
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/statelessScope.js29
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/mock/test.js1
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl78
-rw-r--r--sandbox/old/contrib/implementation-javascript/container/src/test/resources/sequences.xsd100
-rw-r--r--sandbox/old/contrib/implementation-javascript/pom.xml.off92
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/pom.xml.off64
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java34
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldService.java25
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.componentType9
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.js3
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/NOTICE18
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java50
-rw-r--r--sandbox/old/contrib/implementation-javascript/samples/pom.xml.off102
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/pom.xml.off73
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java117
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentBuilder.java82
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentType.java34
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentTypeLoader.java122
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementation.java48
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementationLoader.java122
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyIntrospector.java174
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java72
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyRefInvocInterceptor.java92
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyReferenceProxy.java127
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubySCAConfig.java159
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScript.java160
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScriptInstance.java61
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyUtils.java71
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/default.scdl46
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/ruby.system.scdl46
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldService.java24
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldServiceImpl.java42
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyImplementationLoaderTestCase.java109
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyScriptIntrospectorTestCase.java130
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/ScriptInvokeTestCase.java54
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/WireTestCase.java184
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/function/HelloWorldTestCase.java75
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/mock/Greeting.java26
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.componentType28
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.rb33
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/IntrospectableHelloWorld.rb30
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/helloworld.scdl44
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.componentType26
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.rb24
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/jruby/helloworld.wsdl78
-rw-r--r--sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/mock/test.rb1
-rw-r--r--sandbox/old/contrib/implementation-ruby/pom.xml.off71
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/README.txt34
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/pom.xml.off65
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java34
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldService.java25
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.componentType27
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.rb24
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/NOTICE15
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java47
-rw-r--r--sandbox/old/contrib/implementation-ruby/samples/pom.xml.off102
-rwxr-xr-xsandbox/old/contrib/implementation-script/container.jsr223/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/pom.xml.off118
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/InstanceWrapperBase.java53
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponent.java187
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentBuilder.java60
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentType.java37
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentTypeLoader.java68
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementation.java62
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementationLoader.java97
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptInvoker.java130
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireObjectFactory.java85
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireUtils.java114
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/main/resources/META-INF/sca/script.system.scdl40
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptImplementationLoaderTestCase.java84
-rw-r--r--sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptInvokerTestCase.java51
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/pom.xml.off129
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java49
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java46
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java56
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java81
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java70
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java57
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl50
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl50
-rw-r--r--sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sandbox/old/contrib/implementation-script/pom.xml.off40
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/pom.xml.off61
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.componentType28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.groovy4
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/resources/itest.scdl31
-rw-r--r--sandbox/old/contrib/implementation-script/testing/groovy/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/pom.xml.off67
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.componentType28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.js3
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/resources/itest.scdl31
-rw-r--r--sandbox/old/contrib/implementation-script/testing/javascript/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/pom.xml.off67
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.componentType28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.rb3
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/resources/itest.scdl31
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jruby/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/pom.xml.off61
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.componentType28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.py3
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/META-INF/sca/default.scdl28
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/resources/itest.scdl31
-rw-r--r--sandbox/old/contrib/implementation-script/testing/jython/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-script/testing/pom.xml.off71
-rw-r--r--sandbox/old/contrib/implementation-spring/container/.ruleset190
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/implementation-spring/container/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/README.txt35
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java49
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java51
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java40
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java51
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java311
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java106
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java203
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java128
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java43
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java57
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java91
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java74
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl46
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers3
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas1
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd83
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java52
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java73
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java45
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java151
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java131
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java76
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java57
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java31
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java42
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java8
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml14
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl37
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml15
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml13
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl37
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml14
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml17
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml11
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off58
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java26
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java29
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl30
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java25
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java50
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml11
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl33
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl27
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off74
-rw-r--r--sandbox/old/contrib/implementation-spring/pom.xml.off141
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml64
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java40
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite47
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp130
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml31
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java45
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java80
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java46
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml58
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java341
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java29
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java27
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java46
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java39
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java76
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite36
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite49
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java45
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml59
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java28
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java46
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java157
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite36
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite39
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java45
-rw-r--r--sandbox/old/contrib/itest/bindings/pom.xml41
-rw-r--r--sandbox/old/contrib/itest/conversations/pom.xml45
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java50
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java48
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java36
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java62
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java75
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java47
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java29
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java75
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java249
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java243
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java43
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java117
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java121
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java93
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java37
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java69
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java34
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java31
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java30
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java496
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java38
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java97
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java43
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java147
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite31
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite43
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite27
-rw-r--r--sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite64
-rw-r--r--sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java55
-rw-r--r--sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java95
-rw-r--r--sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java84
-rw-r--r--sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java322
-rw-r--r--sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java51
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/pom.xml60
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt35
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java77
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl31
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl39
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl52
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl60
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl55
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl29
-rw-r--r--sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl142
-rw-r--r--sandbox/old/contrib/itest/pom.xml.off84
-rw-r--r--sandbox/old/contrib/itest/propertyTest/pom.xml.off40
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java29
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java82
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java30
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java85
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java69
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java25
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java24
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java28
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java52
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java24
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java90
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java57
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java72
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java100
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java72
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java100
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl117
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt1
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl78
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java100
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java68
-rw-r--r--sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl65
-rw-r--r--sandbox/old/contrib/itest/spec-api/pom.xml45
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java26
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java25
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java28
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java27
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java29
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java29
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java23
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java25
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java49
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java31
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java73
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java112
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java78
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite30
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite33
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite29
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite33
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite50
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite50
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite35
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite45
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite44
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite34
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite45
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite88
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite64
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite56
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite52
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java61
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java50
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java64
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java98
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java106
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java60
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java80
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java92
-rw-r--r--sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java78
-rw-r--r--sandbox/old/contrib/itest/specTest/pom.xml.off40
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java45
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java56
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java34
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java26
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java28
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java26
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java29
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java28
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java23
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java28
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java73
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java122
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java83
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl43
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl34
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl49
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl53
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl34
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl44
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl47
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl32
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl43
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl81
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl60
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl52
-rw-r--r--sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl51
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java48
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java39
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java60
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java71
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java89
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java45
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java70
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java81
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java55
-rw-r--r--sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl30
-rw-r--r--sandbox/old/contrib/jmx/DISCLAIMER8
-rw-r--r--sandbox/old/contrib/jmx/LICENSE205
-rw-r--r--sandbox/old/contrib/jmx/NOTICE6
-rw-r--r--sandbox/old/contrib/jmx/pom.xml44
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxException.java48
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxManagementService.java75
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/AbstractAgent.java154
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/Agent.java56
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/ManagementException.java37
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/RmiAgent.java120
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/AnnotationDrivenDynamicMBean.java82
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentationException.java48
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentedComponent.java138
-rw-r--r--sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/ReflectedDynamicMBean.java353
-rw-r--r--sandbox/old/contrib/management-console/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/management-console/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/management-console/pom.xml.off55
-rw-r--r--sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionForm.java49
-rw-r--r--sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionHandler.java64
-rw-r--r--sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/TuscanyServlet.java77
-rw-r--r--sandbox/old/contrib/management-console/src/main/resources/org/apache/tuscany/console/console.scdl45
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/pom.xml.off117
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/src/main/java/org/apache/tuscany/sca/plugin/composite/CompositeMojo.java150
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/src/main/resources/META-INF/plexus/components.xml41
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/src/site/apt/usage.apt41
-rw-r--r--sandbox/old/contrib/maven-composite-plugin/src/site/site.xml37
-rw-r--r--sandbox/old/contrib/maven-standalone-plugin/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/maven-standalone-plugin/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/maven-standalone-plugin/pom.xml.off54
-rw-r--r--sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/Dependency.java112
-rw-r--r--sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/TuscanyStandaloneMojo.java558
-rw-r--r--sandbox/old/contrib/old-doc/extending.chianti.docbin0 -> 135680 bytes
-rw-r--r--sandbox/old/contrib/old-doc/extending.tuscany.pptbin0 -> 97280 bytes
-rw-r--r--sandbox/old/contrib/old-doc/tuscany.architecture.pptbin0 -> 210432 bytes
-rw-r--r--sandbox/old/contrib/old-doc/tuscany.architecture.v4.pdfbin0 -> 700903 bytes
-rw-r--r--sandbox/old/contrib/old-doc/tuscany.architecture.v4.pptbin0 -> 246272 bytes
-rw-r--r--sandbox/old/contrib/old-samples/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/old-samples/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/LICENSE.txt416
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/NOTICE.txt32
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/pom.xml.off61
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/readme.html36
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddService.java25
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideService.java25
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyService.java25
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractService.java25
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/autowire.default.scdl44
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/default.scdl47
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/test/java/calculator/CalculatorTestComponent.java39
-rw-r--r--sandbox/old/contrib/old-samples/common/calculator/src/test/resources/itest.scdl32
-rw-r--r--sandbox/old/contrib/old-samples/common/pom.xml.off36
-rw-r--r--sandbox/old/contrib/old-samples/common/readme.html40
-rw-r--r--sandbox/old/contrib/old-samples/css/samples.css30
-rw-r--r--sandbox/old/contrib/old-samples/faq.html30
-rw-r--r--sandbox/old/contrib/old-samples/pom.xml.off83
-rw-r--r--sandbox/old/contrib/old-samples/readme.html93
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/LICENSE.txt416
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/NOTICE.txt32
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/pom.xml.off52
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/readme.html69
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorClient.java59
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/autowire.default.scdl56
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/default.scdl59
-rw-r--r--sandbox/old/contrib/old-samples/standalone/calculator/src/test/java/calculator/CalculatorClientTestCase.java46
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/LICENSE.txt416
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/NOTICE.txt32
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/pom.xml.off47
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/readme.html86
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/ClientService.java28
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/impl/ClientServiceImpl.java85
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java47
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java45
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java75
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java75
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java34
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java55
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java51
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/RateService.java28
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java32
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java101
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/RateServiceImpl.java38
-rw-r--r--sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl68
-rw-r--r--sandbox/old/contrib/old-samples/standalone/pom.xml.off33
-rw-r--r--sandbox/old/contrib/old-samples/webapp/pom.xml.off63
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/LICENSE.txt416
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/NOTICE.txt32
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/pom.xml.off54
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/readme.html118
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/default.scdl33
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/web.xml40
-rw-r--r--sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/calc.jsp40
-rw-r--r--sandbox/old/contrib/persistence/common/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/persistence/common/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/persistence/common/pom.xml.off85
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilder.java66
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/EntityManagerProxy.java86
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/JpaConstants.java47
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceContextProcessor.java161
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitBuilder.java41
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitProcessor.java122
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScanner.java99
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyJpaException.java50
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyPersistenceUnitInfo.java288
-rw-r--r--sandbox/old/contrib/persistence/common/src/main/resources/META-INF/sca/jpa.scdl38
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java29
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java30
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java30
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java32
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java32
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java26
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/resources/META-INF/persistence.xml36
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/resources/META-INF/sca/test1.scdl27
-rw-r--r--sandbox/old/contrib/persistence/datasource/.ruleset190
-rwxr-xr-xsandbox/old/contrib/persistence/datasource/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/persistence/datasource/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/persistence/datasource/pom.xml.off61
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/AmbiguousPropertyException.java40
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java111
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceBuilder.java74
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceCloseException.java31
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java111
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementation.java60
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoader.java86
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceProvider.java52
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/Injector.java45
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/MissingPropertyException.java44
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderException.java33
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactory.java73
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/main/resources/META-INF/sca/dataSource.scdl39
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoaderTestCase.java88
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceBuilderTestCase.java91
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java41
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoaderTestCase.java70
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/InjectorTestCase.java53
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactoryTestCase.java150
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java50
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java50
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/mock/Provider.java79
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl30
-rw-r--r--sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl30
-rw-r--r--sandbox/old/contrib/persistence/openjpa/.ruleset190
-rw-r--r--sandbox/old/contrib/persistence/openjpa/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/persistence/openjpa/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/persistence/openjpa/pom.xml.off62
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/Constants.java35
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryImplementation.java38
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryNotConfiguredException.java31
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerObjectFactory.java54
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerProcessor.java88
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/InvalidInjectionSite.java35
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAAtomicComponent.java70
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAComponentBuilder.java55
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAImportLoader.java56
-rw-r--r--sandbox/old/contrib/persistence/openjpa/src/test/java/org/apache/tuscany/service/openjpa/EntityManagerProcessorTestCase.java135
-rw-r--r--sandbox/old/contrib/persistence/pom.xml.off65
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/.ruleset190
-rwxr-xr-xsandbox/old/contrib/persistence/store.jdbc/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/pom.xml.off67
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Converter.java134
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java347
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/NonSerializableTypeException.java31
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Record.java124
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/TCCLObjectInputStream.java42
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverter.java117
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverter.java101
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/JDBCConverter.java98
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreInsertTestCase.java133
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreTestCase.java100
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreUpdateTestCase.java102
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/RecordTestCase.java66
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/TestUtils.java72
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverterTestCase.java88
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverterTestCase.java89
-rw-r--r--sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/integration/BootstrapTestCase.java36
-rw-r--r--sandbox/old/contrib/persistence/store.journal/.ruleset190
-rwxr-xr-xsandbox/old/contrib/persistence/store.journal/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/persistence/store.journal/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/persistence/store.journal/pom.xml.off74
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/CacheEventListener.java33
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Header.java150
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Journal.java99
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalIinitializationException.java33
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalRecord.java67
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalShutdownException.java33
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStore.java595
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStorePropertyException.java33
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordEntry.java80
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordKey.java67
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/SerializationHelper.java224
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/TCCLObjectInputStream.java42
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreExpireTestCase.java89
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreInsertTestCase.java134
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreOverflowTestCase.java91
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalTestCase.java78
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/MockSCAExternalizable.java57
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/RecordKeyTestCase.java77
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/SerializationHelperTestCase.java93
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/TestUtils.java47
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/Foo.java52
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalStoreThroughputTest.java117
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalThroughputTest.java146
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockMonitor.java58
-rw-r--r--sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockSCAObject.java66
-rw-r--r--sandbox/old/contrib/repository-maven/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/repository-maven/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/repository-maven/pom.xml.off52
-rw-r--r--sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenArtifactRepository.java101
-rw-r--r--sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenHelper.java296
-rw-r--r--sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/TuscanyDependencyException.java58
-rw-r--r--sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/WarRepositoryHelper.java116
-rw-r--r--sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/MavenArtifactRepositoryTestCase.java96
-rw-r--r--sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/WarRepositoryHelperTestCase.java78
-rw-r--r--sandbox/old/contrib/repository-maven/src/test/resources/webapp.warbin0 -> 443672 bytes
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/pom.xml.off90
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/Dependency.java81
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedArtifactRepository.java159
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java88
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenMonitorFactory.java136
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenRuntimeInfo.java56
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java81
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java79
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java429
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnit.java56
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnitLoader.java54
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentBuilder.java192
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentTypeLoader.java146
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitServiceContract.java35
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/main/resources/META-INF/tuscany/embeddedMaven.scdl174
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/site/apt/usage.apt158
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/site/fml/faq.fml65
-rw-r--r--sandbox/old/contrib/runtime-itest/plugin/src/site/site.xml33
-rw-r--r--sandbox/old/contrib/runtime-itest/pom.xml.off53
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/pom.xml.off58
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java37
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/src/main/resources/META-INF/sca/default.scdl27
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java35
-rw-r--r--sandbox/old/contrib/runtime-itest/smoketest/src/test/resources/itest.scdl30
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt163
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off68
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt18
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl168
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl189
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/standalone.xml87
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/.ruleset190
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off67
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java98
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties23
-rw-r--r--sandbox/old/contrib/runtime-standalone/pom.xml.off64
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off63
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java108
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off79
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java264
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java49
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java49
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off100
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java37
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java50
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl33
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java63
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java131
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java33
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java88
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt1
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt1
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off39
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java303
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java44
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java62
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java78
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off50
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java64
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java143
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java51
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java193
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java113
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java55
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java37
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/pom.xml.off80
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/Dependency.java90
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/TuscanyWarMojo.java508
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/src/site/apt/usage.apt46
-rw-r--r--sandbox/old/contrib/runtime-webapp/plugin.war/src/site/site.xml37
-rw-r--r--sandbox/old/contrib/runtime-webapp/pom.xml.off68
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/LICENSE.txt1407
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/pom.xml.off118
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloServiceImpl.java37
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/TestServlet.java52
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/default.scdl35
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/web.xml46
-rw-r--r--sandbox/old/contrib/runtime-webapp/smoketest/src/test/java/org/apache/tuscany/sca/runtime/webapp/smoketest/SmokeTestContext.java58
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/.ruleset190
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/pom.xml.off53
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/Constants.java116
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/InvalidResourcePath.java31
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherMonitor.java33
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java114
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java63
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyInitException.java48
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyRequestListener.java76
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyServlet.java58
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanySessionListener.java53
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java93
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java35
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java67
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java56
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java124
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyContextListenerTestCase.java113
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyFilterTestCase.java112
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyServletTestCase.java80
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanySessionListenerTestCase.java78
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java131
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/.ruleset190
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/pom.xml.off66
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionId.java58
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletHostImpl.java142
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherInitException.java48
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/UnSupportedRuntimeException.java44
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebResourceScanExtender.java83
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java209
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappBuilder.java65
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponent.java165
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentType.java34
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentTypeLoader.java46
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappImplementation.java27
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappLoader.java123
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/main/resources/META-INF/tuscany/webapp.scdl193
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/Foo.java25
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/FooImpl.java25
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionIdTestCase.java44
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/ServletHostTestCase.java86
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java98
-rw-r--r--sandbox/old/contrib/runtime-webapp/webapp-host/src/test/resources/testapp.scdl26
-rw-r--r--sandbox/old/contrib/topology-xml/DISCLAIMER8
-rw-r--r--sandbox/old/contrib/topology-xml/LICENSE205
-rw-r--r--sandbox/old/contrib/topology-xml/NOTICE6
-rw-r--r--sandbox/old/contrib/topology-xml/pom.xml44
-rw-r--r--sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/BaseTopologyArtifactProcessor.java141
-rw-r--r--sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/Constants.java48
-rw-r--r--sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyDocumentProcessor.java93
-rw-r--r--sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyProcessor.java176
-rw-r--r--sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/ReadDocumentTestCase.java89
-rw-r--r--sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/TestModelResolver.java63
-rw-r--r--sandbox/old/contrib/topology-xml/src/test/resources/org/apache/tuscany/sca/topology/xml/runtime.topology35
-rw-r--r--sandbox/old/contrib/topology/DISCLAIMER8
-rw-r--r--sandbox/old/contrib/topology/LICENSE205
-rw-r--r--sandbox/old/contrib/topology/NOTICE6
-rw-r--r--sandbox/old/contrib/topology/pom.xml44
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java63
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java31
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java73
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java48
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java72
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java55
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java72
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java120
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java55
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java91
-rw-r--r--sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java50
-rw-r--r--sandbox/old/contrib/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java105
-rw-r--r--sandbox/old/contrib/transaction-geronimo/.ruleset190
-rwxr-xr-xsandbox/old/contrib/transaction-geronimo/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/transaction-geronimo/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/transaction-geronimo/pom.xml.off93
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceException.java43
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceInitializationException.java41
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceShutdownException.java41
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogService.java200
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerService.java155
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/HOWLLog.java255
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/XATerminatorService.java41
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/main/resources/META-INF/sca/geronimo.jta.scdl56
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/TestUtils.java44
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTMServiceHostRegistryTestCase.java65
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogServiceTestCase.java66
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerServiceTestCase.java143
-rw-r--r--sandbox/old/contrib/transaction-geronimo/src/test/resources/META-INF/sca/test.scdl24
-rw-r--r--sandbox/old/distribution/pom.xml81
-rw-r--r--sandbox/old/distribution/sca/pom.xml64
-rw-r--r--sandbox/old/distribution/sca/standalone/LICENSE.txt202
-rw-r--r--sandbox/old/distribution/sca/standalone/NOTICE.txt19
-rw-r--r--sandbox/old/distribution/sca/standalone/extensions.scdl30
-rw-r--r--sandbox/old/distribution/sca/standalone/pom.xml155
-rw-r--r--sandbox/old/distribution/sca/standalone/src/main/assembly/standalone.xml140
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/README.txt59
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo.app/LICENSE.txt202
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo.app/NOTICE.txt163
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo.app/pom.xml82
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorForm.java92
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorHandler.java130
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/LICENSE.txt202
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/NOTICE.txt163
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/demo.xml139
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/pom.xml110
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/etc/runtime.properties1
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/system.scdl368
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/etc/runtime.properties1
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/system.scdl337
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/etc/runtime.properties1
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/system.scdl340
-rw-r--r--sandbox/old/distribution/sca/tsss-demo/pom.xml59
-rw-r--r--sandbox/old/distribution/sca/web/LICENSE.txt202
-rw-r--r--sandbox/old/distribution/sca/web/NOTICE.txt19
-rw-r--r--sandbox/old/distribution/sca/web/pom.xml94
-rw-r--r--sandbox/old/distribution/sca/web/src/main/assembly/servlet.xml67
-rw-r--r--sandbox/old/doc/tuscany.databinding.pptbin0 -> 2371584 bytes
-rw-r--r--sandbox/old/doc/tuscany.webinar.final.pdfbin0 -> 526480 bytes
1186 files changed, 109227 insertions, 0 deletions
diff --git a/sandbox/old/contrib/binding-celtix/binding/.checkstyle b/sandbox/old/contrib/binding-celtix/binding/.checkstyle
new file mode 100644
index 0000000000..048a1cef2e
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/.checkstyle
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sandbox/old/contrib/binding-celtix/binding/.pmd b/sandbox/old/contrib/binding-celtix/binding/.pmd
new file mode 100644
index 0000000000..138693a60b
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/.pmd
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sandbox/old/contrib/binding-celtix/binding/.ruleset b/sandbox/old/contrib/binding-celtix/binding/.ruleset
new file mode 100644
index 0000000000..0933c1569c
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt b/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/binding-celtix/binding/NOTICE.txt b/sandbox/old/contrib/binding-celtix/binding/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/binding-celtix/binding/README.txt b/sandbox/old/contrib/binding-celtix/binding/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sandbox/old/contrib/binding-celtix/binding/pom.xml.off b/sandbox/old/contrib/binding-celtix/binding/pom.xml.off
new file mode 100644
index 0000000000..838016048e
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/pom.xml.off
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>celtix</artifactId>
+ <name>Apache Tuscany Binding for Celtix</name>
+ <description>Implementation of the SCA Web Services binding using Celtix.</description>
+
+ <properties>
+ <celtix.version>1.0</celtix.version>
+ <checkstyle.properties>checkstyle.severity=error</checkstyle.properties>
+ <sourcechecks.force>true</sourcechecks.force>
+ </properties>
+ <repositories>
+ <repository>
+ <id>objectweb</id>
+ <name>ObjectWeb repo</name>
+ <url>http://maven.objectweb.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>core</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Celtix -->
+ <dependency>
+ <groupId>org.objectweb.celtix</groupId>
+ <artifactId>celtix-rt</artifactId>
+ <version>${celtix.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java
new file mode 100644
index 0000000000..238fbe97b0
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import org.objectweb.celtix.Bus;
+
+/**
+ * A system service that returns the active Celtix <code>Bus</code> for the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BusService {
+
+ /**
+ * Returns the active bus
+ */
+ Bus getBus();
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java
new file mode 100644
index 0000000000..6b02dd0b15
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.BusException;
+
+/**
+ * The default implementation of the Celtix Bus system service
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class BusServiceImpl implements BusService {
+ protected WSDLDefinitionRegistry wsdlRegistry;
+ private Bus bus;
+
+ public BusServiceImpl(@Property(override = "may")WSDLDefinitionRegistry wsdlRegistry) throws BusException {
+ this.wsdlRegistry = wsdlRegistry;
+ Map<String, Object> properties = new WeakHashMap<String, Object>();
+ properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlRegistry));
+ bus = Bus.init(new String[0], properties);
+ }
+
+ public Bus getBus() {
+ return bus;
+ }
+
+ /**
+ * Shuts down the bus, called when the runtime stops the Celtix system composite
+ *
+ * @throws BusException
+ */
+ @Destroy
+ public void stop() throws BusException {
+ bus.shutdown(true);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java
new file mode 100644
index 0000000000..7eec916261
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+
+import commonj.sdo.helper.TypeHelper;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.objectweb.celtix.Bus;
+
+/**
+ * Builds a {@link org.apache.tuscany.spi.component.ServiceBinding} or {@link org.apache.tuscany.spi.component.ReferenceBinding}
+ * configured with the Celtix binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class CeltixBindingBuilder extends BindingBuilderExtension<WebServiceBindingDefinition> {
+
+ private Bus bus;
+
+ public ServiceBinding build(CompositeComponent parent,
+ BoundServiceDefinition boundServiceDefinition,
+ WebServiceBindingDefinition bindingDefinition,
+ DeploymentContext deploymentContext) {
+ TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
+ if (typeHelper == null) {
+ typeHelper = TypeHelper.INSTANCE;
+ }
+ if (bus == null) {
+ bus = getBus(bindingDefinition.getWSDLDefinitionRegistry());
+ }
+ return new CeltixServiceBinding(
+ boundServiceDefinition.getName(),
+ parent,
+ bindingDefinition,
+ bus,
+ typeHelper);
+ }
+
+ public ReferenceBinding build(CompositeComponent parent,
+ BoundReferenceDefinition boundReferenceDefinition,
+ WebServiceBindingDefinition wsBinding,
+ DeploymentContext deploymentContext) {
+ TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
+ if (typeHelper == null) {
+ typeHelper = TypeHelper.INSTANCE;
+ }
+ if (bus == null) {
+ bus = getBus(wsBinding.getWSDLDefinitionRegistry());
+ }
+ return new CeltixReferenceBinding(
+ boundReferenceDefinition.getName(),
+ parent,
+ wsBinding,
+ bus,
+ typeHelper);
+ }
+
+ protected Class<WebServiceBindingDefinition> getBindingType() {
+ return WebServiceBindingDefinition.class;
+ }
+
+ private Bus getBus(WSDLDefinitionRegistry wsdlDefinitionRegistry) {
+ Bus celtixBus = null;
+ try {
+ Map<String, Object> properties = new WeakHashMap<String, Object>();
+ properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlDefinitionRegistry));
+ celtixBus = Bus.init(new String[0], properties);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return celtixBus;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java
new file mode 100644
index 0000000000..3982d9c879
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import javax.jws.WebParam;
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import commonj.sdo.helper.TypeHelper;
+import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback;
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.BusException;
+import org.objectweb.celtix.bindings.ClientBinding;
+import org.objectweb.celtix.bindings.DataBindingCallback;
+import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.context.ObjectMessageContext;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
+import org.xmlsoap.schemas.wsdl.http.AddressType;
+
+
+/**
+ * Responsible for dispatching a service operation invocation on a reference to the active Celtix <code>Bus</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class CeltixInvoker implements TargetInvoker {
+
+ private WSDLMetaDataCache wsdlCache;
+
+ private ClientBinding clientBinding;
+
+ private String operationName;
+
+ private TypeHelper typeHelper;
+
+ public CeltixInvoker(String operationName,
+ Bus bus,
+ Port port,
+ Service wsdlService,
+ Definition wsdlDef,
+ TypeHelper theTypeHelper) throws BuilderException {
+ this.wsdlCache = new WSDLMetaDataCache(wsdlDef, port);
+ this.operationName = operationName;
+ this.typeHelper = theTypeHelper;
+ // Definition wsdlDef = wsBinding.getWSDLDefinition();
+ // wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort());
+
+ try {
+ String key = wsdlDef.getDocumentBaseURI();
+ URL url = new URL(key);
+
+ QName qName = wsdlService.getQName();
+ EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, qName, port.getName());
+
+ String bindingId = null;
+ Binding binding = port.getBinding();
+ if (null != binding) {
+ List list = binding.getExtensibilityElements();
+ if (!list.isEmpty()) {
+ bindingId = ((ExtensibilityElement) list.get(0)).getElementType().getNamespaceURI();
+ }
+ }
+ if (bindingId == null) {
+ List<?> list = port.getExtensibilityElements();
+ for (Object ep : list) {
+ ExtensibilityElement ext = (ExtensibilityElement) ep;
+ if (ext instanceof SOAPAddress) {
+ bindingId = ((SOAPAddress) ext).getLocationURI();
+ }
+ if (ext instanceof AddressType) {
+ bindingId = ((AddressType) ext).getLocation();
+ }
+ }
+
+ }
+ clientBinding = bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference);
+ } catch (MalformedURLException e) {
+ throw new InvokerCreationException(e);
+ } catch (BusException e) {
+ throw new InvokerCreationException(e);
+ } catch (WSDLException e) {
+ throw new InvokerCreationException(e);
+ } catch (IOException e) {
+ throw new InvokerCreationException(e);
+ }
+ }
+
+ /**
+ * Invoke an operation on the external Web service.
+ *
+ * @param args the Java object arguments to the WS operation
+ * @return the response from the WS as a Java object
+ */
+ public Object invokeTarget(final Object args, final short sequence) throws InvocationTargetException {
+ WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName);
+ if (opInfo == null) {
+ // REVISIT - really map the operation name to a WSDL operation
+ for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
+ if (operationName.equalsIgnoreCase(opName)) {
+ opInfo = wsdlCache.getOperationInfo(opName);
+ break;
+ }
+ }
+ }
+
+ ObjectMessageContext objMsgContext = clientBinding.createObjectContext();
+
+ boolean hasInOut = false;
+ int inOutCount = 0;
+ Object realArgs[];
+ Object argsArray[];
+ if (args.getClass().isArray()) {
+ argsArray = (Object[]) args;
+ realArgs = new Object[Array.getLength(args)];
+ } else {
+ argsArray = new Object[0];
+ realArgs = new Object[0];
+ }
+
+ if (opInfo.getParamsLength() == 0) {
+ // REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case.
+ // Bug in Celtix
+ realArgs = argsArray;
+ } else {
+ for (int x = 0; x < argsArray.length; x++) {
+ if (opInfo.getWebParam(x).mode() == WebParam.Mode.IN) {
+ realArgs[x] = argsArray[x];
+ } else {
+ realArgs[x] = new Holder<Object>(argsArray[x]);
+ inOutCount++;
+ hasInOut = true;
+ }
+ }
+ }
+ objMsgContext.setMessageObjects(realArgs);
+ boolean isOneway = opInfo.isOneWay();
+ DataBindingCallback callback = new SCADataBindingCallback(opInfo, hasInOut, typeHelper);
+ try {
+ if (isOneway) {
+ clientBinding.invokeOneWay(objMsgContext, callback);
+ } else {
+ objMsgContext = clientBinding.invoke(objMsgContext, callback);
+ }
+ } catch (IOException e) {
+ throw new InvocationTargetException(e);
+ }
+
+ if (objMsgContext.getException() != null) {
+ // REVISIT - Exceptions
+ /*
+ * if (isValidException(objMsgContext)) { throw
+ * (Exception)objMsgContext.getException(); } else { throw new
+ * ProtocolException(objMsgContext.getException()); }
+ */
+ throw new InvocationTargetException(objMsgContext.getException());
+ }
+
+ if (hasInOut) {
+ Object ret[] = new Object[inOutCount + 1];
+ ret[0] = objMsgContext.getReturn();
+ inOutCount = 1;
+ for (int x = 0; x < argsArray.length; x++) {
+ if (opInfo.getWebParam(x).mode() != WebParam.Mode.IN) {
+ Holder<?> holder = (Holder<?>) realArgs[x];
+ ret[inOutCount] = holder.value;
+ inOutCount++;
+ }
+ }
+ return ret;
+ }
+ return objMsgContext.getReturn();
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE);
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+ throw new UnsupportedOperationException();
+ }
+
+ public CeltixInvoker clone() throws CloneNotSupportedException {
+ try {
+ return (CeltixInvoker) super.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java
new file mode 100644
index 0000000000..c596701880
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import commonj.sdo.helper.TypeHelper;
+import org.objectweb.celtix.Bus;
+
+/**
+ * The implementation of a {@link org.apache.tuscany.spi.component.ReferenceBinding} configured with the Celtix binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class CeltixReferenceBinding<T> extends ReferenceBindingExtension {
+ private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+
+ private Bus bus;
+ private Port port;
+ private Definition wsdlDef;
+ private Service wsdlService;
+ private TypeHelper typeHelper;
+
+ public CeltixReferenceBinding(String name,
+ CompositeComponent parent,
+ WebServiceBindingDefinition binding,
+ Bus theBus,
+ TypeHelper theTypeHelper) {
+ super(name, parent);
+ this.wsdlDef = binding.getWSDLDefinition();
+ this.port = binding.getWSDLPort();
+ this.wsdlService = binding.getWSDLService();
+ this.bus = theBus;
+ this.typeHelper = theTypeHelper;
+ }
+
+ public QName getBindingType() {
+ return BINDING_WS;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ try {
+ return new CeltixInvoker(operation.getName(), bus, port, wsdlService, wsdlDef, typeHelper);
+ } catch (BuilderException e) {
+ // fixme
+ throw new CeltixServiceInitException(e);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java
new file mode 100644
index 0000000000..96996e73c1
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java
@@ -0,0 +1,281 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import javax.jws.soap.SOAPBinding;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceProvider;
+
+import org.osoa.sca.annotations.Destroy;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+
+import commonj.sdo.helper.TypeHelper;
+import org.apache.tuscany.binding.celtix.io.SCAServerDataBindingCallback;
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.BindingFactory;
+import org.objectweb.celtix.bindings.DataBindingCallback;
+import org.objectweb.celtix.bindings.ServerBinding;
+import org.objectweb.celtix.bindings.ServerBindingEndpointCallback;
+import org.objectweb.celtix.bindings.ServerDataBindingCallback;
+import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.context.ObjectMessageContext;
+import org.objectweb.celtix.ws.addressing.AttributedURIType;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
+import org.xmlsoap.schemas.wsdl.http.AddressType;
+
+
+/**
+ * An implementation of a {@link Service} configured with the Celtix binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class CeltixServiceBinding extends ServiceBindingExtension implements ServerBindingEndpointCallback {
+ private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+
+ private Bus bus;
+ private Port port;
+ private Definition wsdlDef;
+ private Service wsdlService;
+ private WSDLMetaDataCache wsdlCache;
+ private TypeHelper typeHelper;
+
+ private Map<QName, ServerDataBindingCallback> opMap =
+ new ConcurrentHashMap<QName, ServerDataBindingCallback>();
+
+
+ public CeltixServiceBinding(String theName,
+ CompositeComponent parent,
+ WebServiceBindingDefinition binding,
+ Bus bus,
+ TypeHelper theTypeHelper) {
+ super(theName, parent);
+ this.wsdlDef = binding.getWSDLDefinition();
+ this.port = binding.getWSDLPort();
+ this.wsdlService = binding.getWSDLService();
+ this.bus = bus;
+ this.wsdlCache = new WSDLMetaDataCache(wsdlDef, port);
+ this.typeHelper = theTypeHelper;
+ }
+
+ public void start() {
+ super.start();
+ initOperationMap();
+ startServerBinding();
+ }
+
+ private void startServerBinding() {
+ String key = wsdlDef.getDocumentBaseURI();
+ URL url;
+ try {
+ url = new URL(key);
+ } catch (MalformedURLException e) {
+ throw new CeltixServiceInitException(e);
+ }
+
+ QName qName = wsdlService.getQName();
+ String portName = port.getName();
+ EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, qName, portName);
+
+ AttributedURIType address = new AttributedURIType();
+
+ String bindingId = null;
+ Binding binding = port.getBinding();
+ if (null != binding) {
+ List list = binding.getExtensibilityElements();
+ if (!list.isEmpty()) {
+ bindingId = ((ExtensibilityElement) list.get(0)).getElementType().getNamespaceURI();
+ }
+ }
+ List<?> list = port.getExtensibilityElements();
+ for (Object ep : list) {
+ ExtensibilityElement ext = (ExtensibilityElement) ep;
+ if (ext instanceof SOAPAddress) {
+ if (bindingId == null) {
+ bindingId = ((SOAPAddress) ext).getLocationURI();
+ }
+ address.setValue(((SOAPAddress) ext).getLocationURI());
+ }
+ if (ext instanceof AddressType) {
+ if (bindingId == null) {
+ bindingId = ((AddressType) ext).getLocation();
+ }
+ address.setValue(((AddressType) ext).getLocation());
+ }
+ }
+ if (reference.getAddress() == null) {
+ //REVIST - bug in Celtix that the HTTP transport won't find the address correctly
+ reference.setAddress(address);
+ }
+ ClassLoader previousLoader = null;
+ try {
+ //FIXME: This hack is because SAAJImpl uses Thread.currentThread().getContextClassLoader(),
+ //this classloader is different from current classLoader.
+ previousLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ BindingFactory bindingFactory = bus.getBindingManager().getBindingFactory(bindingId);
+ ServerBinding serverBinding = bindingFactory.createServerBinding(reference, this);
+ serverBinding.activate();
+ } catch (Exception e) {
+ throw new CeltixServiceInitException(e);
+ } finally {
+ if (previousLoader != null) {
+ Thread.currentThread().setContextClassLoader(previousLoader);
+ }
+ }
+ }
+
+ private void initOperationMap() {
+ List ops = port.getBinding().getBindingOperations();
+ for (Object op1 : ops) {
+ BindingOperation op = (BindingOperation) op1;
+ BindingInput bindingInput = op.getBindingInput();
+ List elements = bindingInput.getExtensibilityElements();
+ QName qn = new QName(wsdlDef.getTargetNamespace(), op.getName());
+
+ //In case soap:body namespace is different from targetNamespace
+ for (Object element : elements) {
+ if (SOAPBody.class.isInstance(element)) {
+ SOAPBody body = (SOAPBody) element;
+ if (body.getNamespaceURI() != null) {
+ qn = new QName(body.getNamespaceURI(), op.getName());
+ }
+ }
+ }
+
+ ServerDataBindingCallback cb = getDataBindingCallback(qn, null, DataBindingCallback.Mode.PARTS);
+ opMap.put(qn, cb);
+ if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) {
+ opMap.put(cb.getRequestWrapperQName(), cb);
+ }
+ }
+ }
+
+ @Destroy
+ public void stop() throws CoreRuntimeException {
+ super.stop();
+ }
+
+ public ServerDataBindingCallback getDataBindingCallback(QName operationName,
+ ObjectMessageContext objContext,
+ DataBindingCallback.Mode mode) {
+ if (opMap.containsKey(operationName)) {
+ return opMap.get(operationName);
+ }
+ WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart());
+ if (opInfo == null) {
+ //REVISIT - really map the operation name to a WSDL operation
+ for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
+ if (operationName.getLocalPart().equalsIgnoreCase(opName)) {
+ opInfo = wsdlCache.getOperationInfo(opName);
+ break;
+ }
+ }
+ }
+ boolean inout = false;
+
+ // Class<?> serviceInterface = this.getInterface();
+ // Method meth = getMethod(serviceInterface, operationName.getLocalPart());
+
+ // Object proxy = null;
+// try {
+// // proxy = this.getServiceInstance();
+// } catch (TargetException e) {
+// throw new CeltixServiceInitException(e);
+// }
+
+ return new SCAServerDataBindingCallback(opInfo,
+ inout,
+ operationName.getLocalPart(),
+ getInboundWire(),
+ typeHelper);
+ }
+
+// protected Method getMethod(Class<?> serviceInterface, String operationName) {
+// // Note: this doesn't support overloaded operations
+// Method[] methods = serviceInterface.getMethods();
+// for (Method m : methods) {
+// if (m.getName().equals(operationName)) {
+// return m;
+// }
+// // tolerate WSDL with capatalized operation name
+// StringBuilder sb = new StringBuilder(operationName);
+// sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
+// if (m.getName().equals(sb.toString())) {
+// return m;
+// }
+// }
+// // FIXME
+// throw new CeltixServiceInitException("no operation named " + operationName
+// + " found on service interface: " + serviceInterface.getName());
+// }
+
+ public DataBindingCallback getFaultDataBindingCallback(ObjectMessageContext objContext) {
+ // REVISIT - what to do about faults
+ return null;
+ }
+
+ public Map<QName, ? extends DataBindingCallback> getOperations() {
+ return opMap;
+ }
+
+ public SOAPBinding.Style getStyle() {
+ return wsdlCache.getStyle();
+ }
+
+ public DataBindingCallback.Mode getServiceMode() {
+ return DataBindingCallback.Mode.PARTS;
+ }
+
+ public WebServiceProvider getWebServiceProvider() {
+ //not needed I think
+ return null;
+ }
+
+ public Executor getExecutor() {
+ //Let the transport handle it (or it goes to the Bus default wq
+ //if the transport cannot handle it
+ return null;
+ }
+
+
+ public QName getBindingType() {
+ return BINDING_WS;
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java
new file mode 100644
index 0000000000..28c4dfaf2a
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an exception starting a {@link CeltixServiceBinding} instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class CeltixServiceInitException extends CoreRuntimeException {
+ public CeltixServiceInitException() {
+ }
+
+ public CeltixServiceInitException(String message) {
+ super(message);
+ }
+
+ public CeltixServiceInitException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CeltixServiceInitException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java
new file mode 100644
index 0000000000..e08a3193d8
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+
+/**
+ * Thrown when an error is encountered creating a {@link CeltixInvoker}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvokerCreationException extends BuilderException {
+ public InvokerCreationException() {
+ }
+
+ public InvokerCreationException(String message) {
+ super(message);
+ }
+
+ public InvokerCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvokerCreationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java
new file mode 100644
index 0000000000..18efe80da5
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.w3c.dom.Element;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+
+import org.objectweb.celtix.wsdl.WSDLManager;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyWSDLManager implements WSDLManager {
+ WSDLDefinitionRegistry wsdlDefinitionRegistry;
+
+ public TuscanyWSDLManager(WSDLDefinitionRegistry w) {
+ wsdlDefinitionRegistry = w;
+ }
+
+ public WSDLFactory getWSDLFactory() {
+ //Not supported
+ return null;
+ }
+
+ public ExtensionRegistry getExtenstionRegistry() {
+ return wsdlDefinitionRegistry.getExtensionRegistry();
+ }
+
+ public Definition getDefinition(URL url) throws WSDLException {
+ try {
+ return wsdlDefinitionRegistry.loadDefinition(null, url);
+ } catch (IOException e) {
+ //FIXME
+ throw new WSDLException("", "", e);
+ }
+ }
+
+ public Definition getDefinition(String url) throws WSDLException {
+ try {
+ //The namespace is the wsdl targetNamesapce, it is only used
+ //when the wsdl is created into cache. we are ok here to set it to null.
+ //FIXME pass the current ResourceLoader
+ return wsdlDefinitionRegistry.loadDefinition(null, new URL(url));
+ } catch (IOException e) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage());
+ }
+ }
+
+ public Definition getDefinition(Element el) throws WSDLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Definition getDefinition(Class<?> sei) throws WSDLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addDefinition(Object key, Definition wsdl) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void shutdown() {
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java
new file mode 100644
index 0000000000..4efd039c26
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * Represents a Celtix binding configuration in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebServiceBindingDefinition extends BindingDefinition {
+
+ private Definition definition;
+ private Port port;
+ private Service service;
+ //private String portURI;
+ private String uri;
+ //We have to use WebServiceBindingDefinition to pass WSDLDefinitionRegistry to BindingBuilder
+ private WSDLDefinitionRegistry wsdlDefinitionRegistry;
+
+ public WebServiceBindingDefinition(Definition definition, Port port, String uri, String portURI, Service service) {
+ this.definition = definition;
+ this.port = port;
+ this.uri = uri;
+ //this.portURI = portURI;
+ this.service = service;
+ }
+
+ public Port getWSDLPort() {
+ return port;
+ }
+
+ public Service getWSDLService() {
+ return service;
+ }
+
+ public void setWSDLPort(Port value) {
+ port = value;
+ }
+
+ public Definition getWSDLDefinition() {
+ return definition;
+ }
+
+ public void setWSDLDefinition(Definition def) {
+ definition = def;
+ }
+
+ public WSDLDefinitionRegistry getWSDLDefinitionRegistry() {
+ return wsdlDefinitionRegistry;
+ }
+
+ public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry theWsdlDefinitionRegistry) {
+ wsdlDefinitionRegistry = theWsdlDefinitionRegistry;
+ }
+
+// public void setPortURI(String uri) {
+// portURI = uri;
+// }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String theUri) {
+ this.uri = theUri;
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java
new file mode 100644
index 0000000000..804cdc09fd
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.xml.sax.InputSource;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.model.ModelObject;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl.Monitor;
+
+/**
+ * Parses a <code>WebServiceBindingDefinition</code> entry in an assembly XML file
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class WebServiceBindingLoader extends LoaderExtension<WebServiceBindingDefinition> {
+ public static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+
+ protected WSDLDefinitionRegistry wsdlRegistry;
+
+ @Constructor({"registry"})
+ public WebServiceBindingLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+
+ //FIXME: this is a hack, WSDLDefinitionRegistry should not be created here
+ if (wsdlRegistry == null) {
+ try {
+ wsdlRegistry = new WSDLDefinitionRegistryImpl();
+ Monitor monitor = new Monitor() {
+ public void readingWSDL(String namespace, URL location) {
+ }
+
+ public void cachingDefinition(String namespace, URL location) {
+ }
+ };
+
+ ((WSDLDefinitionRegistryImpl) wsdlRegistry).setMonitor(monitor);
+ } catch (javax.wsdl.WSDLException e) {
+ //do nothing
+ }
+ }
+ }
+
+ public QName getXMLType() {
+ return BINDING_WS;
+ }
+
+ public WebServiceBindingDefinition load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ // not sure what uri was here ? String uri = reader.getAttributeValue(null, "uri");
+ String uri = null;
+ String endpointAttribute = reader.getAttributeValue(null, "endpoint");
+ //String portURI = reader.getAttributeValue(null, "port");
+ String wsdlLocation = reader.getAttributeValue(null, "location");
+ try {
+ return createBinding(uri, endpointAttribute, wsdlLocation, deploymentContext);
+ } catch (Exception e) {
+
+ throw new LoaderException(e);
+ }
+ }
+
+ private WebServiceBindingDefinition createBinding(String port, String portURI, String wsdlLocation,
+ DeploymentContext deploymentContext)
+ throws WSDLException, IOException {
+ List<Definition> definitions = null;
+ // FIXME wsdlRegistry.getDefinitionsForNamespace(portNamespace,
+ // resourceLoader);
+ // Get the WSDL port namespace and name
+ if (port == null && portURI != null) {
+ int h = portURI.indexOf('#');
+ String portNamespace = portURI.substring(0, h);
+ String serviceName;
+ String portName;
+
+ String fragment = portURI.substring(h + 1);
+ if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) {
+ fragment = fragment.substring(14, fragment.length() - 1);
+ int slash = fragment.indexOf('/');
+ if (slash != -1) {
+ serviceName = fragment.substring(0, slash);
+ portName = fragment.substring(slash + 1);
+ } else {
+ serviceName = null;
+ portName = fragment;
+ }
+ } else {
+ serviceName = null;
+ portName = fragment;
+ }
+
+ // FIXME need to find out how to get wsdl and what context to use --- terrible hack attack!
+ // URL wsdlurl = Thread.currentThread().getContextClassLoader().getResource(wsdlLocation);
+ if (null == wsdlLocation) {
+ throw new RuntimeException("Failed to determin wsdl location on binding. "
+ + "Try specifying 'location' attribute on binding.");
+ }
+ URL wsdlurl = deploymentContext.getClassLoader().getResource(wsdlLocation);
+ if (wsdlurl == null) {
+ throw new RuntimeException("Failed to load wsdl from '" + wsdlLocation + "'");
+ }
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ InputSource input = new InputSource(wsdlurl.openStream());
+ Definition wsdlDef = reader.readWSDL(wsdlurl.toString(), input);
+ definitions = new LinkedList<Definition>();
+ definitions.add(wsdlDef);
+ // FIXME all the above needs to better addressed.
+
+ //FIXME: if a global wsdl cached is used, we need to do a registration here
+ String namespace = wsdlDef.getTargetNamespace();
+ wsdlRegistry.loadDefinition(namespace, wsdlurl);
+
+ Definition definition = null;
+ Port thePort = null;
+ Service service = null;
+ for (Definition def : definitions) {
+
+ // Find the port with the given name
+ for (Service serv : (Collection<Service>) def.getServices().values()) {
+ QName sqn = serv.getQName();
+ if (serviceName != null
+ && !serviceName.equals(sqn.getLocalPart())) {
+ continue;
+ }
+
+ Port p = serv.getPort(portName);
+ if (p != null) {
+ service = serv;
+ definition = def;
+ thePort = p;
+ break;
+ }
+ }
+ }
+ if (thePort == null) {
+ throw new IllegalArgumentException("Cannot find WSDL port " + portURI);
+
+ }
+ WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(definition, thePort, port, portURI, service);
+ wsBinding.setWSDLDefinitionRegistry(wsdlRegistry);
+ return wsBinding;
+ }
+ // FIXME - return a broken binding for now
+ return new WebServiceBindingDefinition(null, null, null, portURI, null);
+
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java
new file mode 100644
index 0000000000..7a14ab33fc
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import static org.w3c.dom.bootstrap.DOMImplementationRegistry.PROPERTY;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSSerializer;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLDocument;
+
+import org.apache.tuscany.core.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.objectweb.celtix.bindings.DataReader;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+public class NodeDataReader implements DataReader<Node> {
+
+ private SCADataBindingCallback callback;
+
+ public NodeDataReader(SCADataBindingCallback cb) {
+ callback = cb;
+ }
+
+ public Object read(int idx, Node input) {
+ return read(null, idx, input);
+ }
+
+ public Object read(QName name, int idx, Node input) {
+ try {
+ InputStream in = getNodeStream(input);
+ XMLInputFactory staxFactory = XMLInputFactory.newInstance();
+ XMLStreamReader reader = staxFactory.createXMLStreamReader(in);
+
+ XMLStreamReader2XMLDocument transformer = new XMLStreamReader2XMLDocument();
+ TransformationContext context = new TransformationContextImpl();
+ DataType<QName> binding = new DataType<QName>(DataObject.class, null);
+ binding.setMetadata(TypeHelper.class.getName(), callback.getTypeHelper());
+ context.setTargetDataType(binding);
+ XMLDocument document = transformer.transform(reader, context);
+
+ boolean isWrapped = false;
+ return toObjects(document, isWrapped);
+ } catch (Exception e) {
+ //REVISIT: better handling of exceptions
+ }
+ return null;
+ }
+
+ public void readWrapper(ObjectMessageContext objCtx, boolean isOutBound, Node input) {
+ try {
+ QName wrapperName;
+ if (isOutBound) {
+ wrapperName = callback.getOperationInfo().getResponseWrapperQName();
+ } else {
+ wrapperName = callback.getOperationInfo().getRequestWrapperQName();
+ }
+
+ Node nd = input.getFirstChild();
+ while (nd != null
+ && !wrapperName.getNamespaceURI().equals(nd.getNamespaceURI())
+ && !wrapperName.getLocalPart().equals(nd.getLocalName())) {
+ nd = nd.getNextSibling();
+ }
+
+ //REVISIT - This is SUCH a HACK. This needs to be done with StAX or something
+ //a bit better than streaming and reparsing
+ InputStream in = getNodeStream(nd);
+ XMLInputFactory staxFactory = XMLInputFactory.newInstance(
+ "javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ XMLStreamReader reader = staxFactory.createXMLStreamReader(in);
+
+ XMLStreamReader2XMLDocument transformer = new XMLStreamReader2XMLDocument();
+ TransformationContext context = new TransformationContextImpl();
+ DataType<QName> binding = new DataType<QName>(DataObject.class, null);
+ binding.setMetadata(TypeHelper.class.getName(), callback.getTypeHelper());
+ context.setTargetDataType(binding);
+ XMLDocument document = transformer.transform(reader, context);
+
+ //boolean isWrapped = true;
+ Object[] objects = toObjects(document, true);
+
+ if (callback.hasInOut()) {
+ //REVISIT - inOuts
+ } else {
+ if (isOutBound) {
+ objCtx.setReturn(objects[0]);
+ } else {
+ objCtx.setMessageObjects(objects);
+ }
+ }
+ } catch (Exception e) {
+ //REVISIT: better handling of exceptions
+ }
+ }
+
+ /**
+ * Convert a typed DataObject to Java objects
+ *
+ * @param document
+ * @param isWrapped
+ * @return the array of Objects from the DataObject
+ */
+ public static Object[] toObjects(XMLDocument document, boolean isWrapped) {
+ DataObject dataObject = document.getRootObject();
+ if (isWrapped) {
+ List ips = dataObject.getInstanceProperties();
+ Object[] os = new Object[ips.size()];
+ for (int i = 0; i < ips.size(); i++) {
+ os[i] = dataObject.get((Property) ips.get(i));
+ }
+ return os;
+ } else {
+ Object object = dataObject;
+ Type type = dataObject.getType();
+ if (type.isSequenced()) {
+ object = dataObject.getSequence().getValue(0);
+ }
+ return new Object[]{object};
+ }
+ }
+
+ byte[] getNodeBytes(Node node)
+ throws ClassCastException, ClassNotFoundException, InstantiationException, IllegalAccessException {
+
+ //This is also a hack, the JDK should already have this set, but it doesn't
+ DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+ if (registry == null) {
+ System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+ registry = DOMImplementationRegistry.newInstance();
+ }
+ DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+ if (impl == null) {
+ System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+ registry = DOMImplementationRegistry.newInstance();
+ impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+ }
+ LSOutput output = impl.createLSOutput();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ output.setByteStream(bout);
+ LSSerializer writer = impl.createLSSerializer();
+ writer.write(node, output);
+
+ return bout.toByteArray();
+ }
+
+ InputStream getNodeStream(Node node)
+ throws ClassCastException, ClassNotFoundException,
+ InstantiationException, IllegalAccessException {
+
+ DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+ if (registry == null) {
+ //This is also a hack, the JDK should already have this set, but it doesn't
+ System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+ registry = DOMImplementationRegistry.newInstance();
+ }
+ DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+ if (impl == null) {
+ System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+ registry = DOMImplementationRegistry.newInstance();
+ impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+ }
+ LSOutput output = impl.createLSOutput();
+ RawByteArrayOutputStream bout = new RawByteArrayOutputStream();
+ output.setByteStream(bout);
+ LSSerializer writer = impl.createLSSerializer();
+ writer.write(node, output);
+
+ return new ByteArrayInputStream(bout.getBytes(), 0, bout.size());
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java
new file mode 100644
index 0000000000..d870cafa87
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix.io;
+
+import java.util.List;
+import javax.xml.namespace.QName;
+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;
+
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.objectweb.celtix.bindings.DataWriter;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+public class NodeDataWriter implements DataWriter<Node> {
+ private static final String XML_NS = "http://www.w3.org/2000/xmlns/";
+ private SCADataBindingCallback callback;
+
+ public NodeDataWriter(SCADataBindingCallback cb) {
+ callback = cb;
+ }
+
+ public void write(Object obj, Node output) {
+ write(obj, null, output);
+ }
+
+ public void write(Object obj, QName elName, Node output) {
+ boolean isWrapped = false;
+
+ XMLDocument document = toXMLDocument(callback.getTypeHelper(), new Object[]{obj}, elName, isWrapped);
+ // HACK: [rfeng] We should use the transformer in an interceptor
+ XMLDocument2XMLStreamReader transformer = new XMLDocument2XMLStreamReader();
+ XMLStreamReader reader = transformer.transform(document, null);
+
+ try {
+ //CeltixFire supports Stax, we should not need to do following anymore.
+ readDocElements(output, reader, true, null);
+ } catch (XMLStreamException e) {
+ throw new InvocationRuntimeException(e.getMessage());
+ }
+ }
+
+ public void writeWrapper(ObjectMessageContext objCtx, boolean isOutbound, Node output) {
+ boolean isWrapped = true;
+ QName wrapperName;
+ if (isOutbound) {
+ wrapperName = callback.getOperationInfo().getResponseWrapperQName();
+ } else {
+ wrapperName = callback.getOperationInfo().getRequestWrapperQName();
+ }
+
+ XMLDocument document = toXMLDocument(
+ callback.getTypeHelper(), objCtx.getMessageObjects(), wrapperName, isWrapped);
+ // HACK: [rfeng] We should use the transformer in an interceptor
+ XMLDocument2XMLStreamReader transformer = new XMLDocument2XMLStreamReader();
+ XMLStreamReader reader = transformer.transform(document, null);
+
+ try {
+ readDocElements(output, reader, true, null);
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ throw new InvocationRuntimeException(e.getMessage());
+ }
+ }
+/*
+ private DataObject toWrappedDataObject(TypeHelper typeHelper,
+ Object ret,
+ Object[] os,
+ QName typeQN) {
+ XSDHelper xsdHelper = new XSDHelperImpl(typeHelper);
+ Property property = xsdHelper.getGlobalProperty(typeQN.getNamespaceURI(),
+ typeQN.getLocalPart(), true);
+ DataObject dataObject = new DataFactoryImpl(typeHelper).create(property.getType());
+ List ips = dataObject.getInstanceProperties();
+ int offset = 0;
+ if (ret != null) {
+ dataObject.set(0, ret);
+ offset = 1;
+ }
+ for (int i = offset; i < ips.size(); i++) {
+ if (os[i - offset] instanceof Holder) {
+ Holder<?> holder = (Holder<?>)os[i - offset];
+ dataObject.set(i, holder.value);
+ } else {
+ dataObject.set(i, os[i - offset]);
+ }
+ }
+ return dataObject;
+ }
+*/
+
+ /**
+ * Convert objects to typed DataObject
+ *
+ * @param typeHelper
+ * @param os
+ * @param elementQName
+ * @param isWrapped
+ * @return the DataObject
+ */
+ private static XMLDocument toXMLDocument(TypeHelper typeHelper,
+ Object[] os,
+ QName elementQName,
+ boolean isWrapped) {
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+
+ Property property = xsdHelper.getGlobalProperty(
+ elementQName.getNamespaceURI(), elementQName.getLocalPart(), true);
+ if (null == property) {
+ throw new InvocationRuntimeException(
+ "Type '" + elementQName.toString() + "' not found in registered SDO types.");
+ }
+ DataObject dataObject;
+ if (isWrapped) {
+ DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
+ dataObject = dataFactory.create(property.getType());
+ List ips = dataObject.getInstanceProperties();
+ for (int i = 0; i < ips.size(); i++) {
+ dataObject.set(i, os[i]);
+ }
+ } else {
+ Object value = os[0];
+ Type type = property.getType();
+ if (!type.isDataType()) {
+ dataObject = (DataObject) value;
+ } else {
+ dataObject = SDOUtil.createDataTypeWrapper(type, value);
+ }
+ }
+
+ XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
+ return xmlHelper.createDocument(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart());
+
+ }
+
+ //REVISIT: We should not need to do following anymore with CeltixFire.
+ //As CeltixFire supports stax directly.
+
+ /**
+ * @param parent
+ * @param reader
+ * @param repairing
+ * @param stopAt: stop at the specified element
+ * @throws XMLStreamException
+ */
+ public static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing, QName stopAt)
+ throws XMLStreamException {
+ Document doc = getDocument(parent);
+
+ int event = reader.getEventType();
+
+ while (reader.hasNext()) {
+ switch (event) {
+ case XMLStreamConstants.START_ELEMENT:
+ if (startElement(parent, reader, repairing, stopAt) == null) {
+ return;
+ }
+ if (parent instanceof Document && stopAt != null) {
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ return;
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ return;
+ case XMLStreamConstants.NAMESPACE:
+ break;
+ case XMLStreamConstants.ATTRIBUTE:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (parent != null) {
+ parent.appendChild(doc.createTextNode(reader.getText()));
+ }
+
+ break;
+ case XMLStreamConstants.COMMENT:
+ if (parent != null) {
+ parent.appendChild(doc.createComment(reader.getText()));
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ parent.appendChild(doc.createCDATASection(reader.getText()));
+
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData()));
+
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData()));
+
+ break;
+ default:
+ break;
+ }
+
+ if (reader.hasNext()) {
+ event = reader.next();
+ }
+ }
+ }
+
+ private static Document getDocument(Node parent) {
+ return (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument();
+ }
+
+ /**
+ * @param parent
+ * @param reader
+ * @return
+ * @throws XMLStreamException
+ */
+ private static Element startElement(Node parent, XMLStreamReader reader, boolean repairing, QName stopAt)
+ throws XMLStreamException {
+ Document doc = getDocument(parent);
+
+ if (stopAt != null && stopAt.getNamespaceURI().equals(reader.getNamespaceURI())
+ && stopAt.getLocalPart().equals(reader.getLocalName())) {
+ return null;
+ }
+
+ Element e = doc.createElementNS(reader.getNamespaceURI(), reader.getLocalName());
+
+ if (reader.getPrefix() != null) {
+ e.setPrefix(reader.getPrefix());
+ }
+
+ parent.appendChild(e);
+
+ for (int ns = 0; ns < reader.getNamespaceCount(); ns++) {
+ String uri = reader.getNamespaceURI(ns);
+ String prefix = reader.getNamespacePrefix(ns);
+
+ declare(e, uri, prefix);
+ }
+
+ for (int att = 0; att < reader.getAttributeCount(); att++) {
+ String name = reader.getAttributeLocalName(att);
+ String prefix = reader.getAttributePrefix(att);
+ if (prefix != null && prefix.length() > 0) {
+ name = prefix + ":" + name;
+ }
+
+ Attr attr = doc.createAttributeNS(reader.getAttributeNamespace(att), name);
+ attr.setValue(reader.getAttributeValue(att));
+ e.setAttributeNode(attr);
+ }
+
+ reader.next();
+
+ readDocElements(e, reader, repairing, stopAt);
+
+ if (repairing && !isDeclared(e, reader.getNamespaceURI(), reader.getPrefix())) {
+ declare(e, reader.getNamespaceURI(), reader.getPrefix());
+ }
+
+ return e;
+ }
+
+ private static void declare(Element node, String uri, String prefix) {
+ if (prefix != null && prefix.length() > 0) {
+ node.setAttributeNS(XML_NS, "xmlns:" + prefix, uri);
+ } else {
+ if (uri != null /* && uri.length() > 0 */) {
+ node.setAttributeNS(XML_NS, "xmlns", uri);
+ }
+ }
+ }
+
+ private static boolean isDeclared(Element e, String namespaceURI, String prefix) {
+ Attr att;
+ if (prefix != null && prefix.length() > 0) {
+ att = e.getAttributeNodeNS(XML_NS, "xmlns:" + prefix);
+ } else {
+ att = e.getAttributeNode("xmlns");
+ }
+
+ if (att != null && att.getNodeValue().equals(namespaceURI)) {
+ return true;
+ }
+
+ if (e.getParentNode() instanceof Element) {
+ return isDeclared((Element) e.getParentNode(), namespaceURI, prefix);
+ }
+
+ return false;
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java
new file mode 100644
index 0000000000..057481041b
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix.io;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Just to allow raw access to the byte[] to avoid a copy
+ */
+class RawByteArrayOutputStream extends ByteArrayOutputStream {
+ public byte[] getBytes() {
+ return buf;
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java
new file mode 100644
index 0000000000..47d130383f
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix.io;
+
+import org.w3c.dom.Node;
+
+import commonj.sdo.helper.TypeHelper;
+import org.objectweb.celtix.bindings.DataReader;
+import org.objectweb.celtix.bindings.DataWriter;
+import org.objectweb.celtix.bus.bindings.AbstractWSDLOperationDataBindingCallback;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCADataBindingCallback extends AbstractWSDLOperationDataBindingCallback {
+
+ protected boolean hasInOut;
+ protected TypeHelper typeHelper;
+
+ public SCADataBindingCallback(WSDLOperationInfo op, boolean inout, TypeHelper theTypeHelper) {
+ super(op);
+ this.hasInOut = inout;
+ this.typeHelper = theTypeHelper;
+ }
+
+ public boolean hasInOut() {
+ return hasInOut;
+ }
+
+ public Mode getMode() {
+ return Mode.PARTS;
+ }
+
+ public Class<?>[] getSupportedFormats() {
+ return new Class<?>[]{Node.class};
+ }
+
+ public TypeHelper getTypeHelper() {
+ return typeHelper;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> DataWriter<T> createWriter(Class<T> cls) {
+ if (cls == Node.class) {
+ return (DataWriter<T>) new NodeDataWriter(this);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> DataReader<T> createReader(Class<T> cls) {
+ if (cls == Node.class) {
+ return (DataReader<T>) new NodeDataReader(this);
+ }
+ //REVISIT - need to figure out what to do with Faults
+ return null;
+ }
+
+ public void initObjectContext(ObjectMessageContext octx) {
+ //REVISIT - is this even used?
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java
new file mode 100644
index 0000000000..056c571ec4
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix.io;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import commonj.sdo.helper.TypeHelper;
+import org.objectweb.celtix.bindings.ServerDataBindingCallback;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCAServerDataBindingCallback extends SCADataBindingCallback
+ implements ServerDataBindingCallback {
+ String operationName;
+ InboundWire wire;
+
+ public SCAServerDataBindingCallback(WSDLOperationInfo op,
+ boolean inout,
+ String operationName,
+ InboundWire wire,
+ TypeHelper theTypeHelper) {
+ super(op, inout, theTypeHelper);
+ this.operationName = operationName;
+ this.wire = wire;
+ }
+
+
+ public void invoke(ObjectMessageContext octx) throws InvocationTargetException {
+ Object ret;
+ try {
+ InboundInvocationChain chain = null;
+ for (Map.Entry<Operation<?>, InboundInvocationChain> entry : wire.getInvocationChains().entrySet()) {
+ if (entry.getKey().getName().equals(operationName)) {
+ chain = entry.getValue();
+ break;
+ }
+ }
+ MessageImpl msg = new MessageImpl();
+ msg.setBody(octx.getMessageObjects());
+ ret = chain.getHeadInterceptor().invoke(msg);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ octx.setReturn(ret);
+ }
+
+// public void initObjectContext(ObjectMessageContext octx) {
+// Object o[] = new Object[method.getParameterTypes().length];
+// //REVIST - holders?
+// octx.setMessageObjects(o);
+// }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..62ce396a5a
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.celtix.WebServiceBinding">
+
+ <component name="ws.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.celtix.WebServiceBindingLoader" />
+ </component>
+
+ <component name="ws.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.celtix.CeltixBindingBuilder" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java
new file mode 100644
index 0000000000..cba83a7792
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BootstrapTestCase extends TestCase {
+
+ public void testReference() throws Exception {
+// BusServiceImpl busService = new BusServiceImpl();
+// WSDLDefinitionRegistry wsdlRegistry = new WSDLDefinitionRegistryImpl();
+// busService.setWsdlRegistry(wsdlRegistry);
+// busService.init();
+// CeltixReference reference = new CeltixReference("reference",);
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java
new file mode 100644
index 0000000000..235144ffbb
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.net.URL;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback;
+import org.easymock.classextension.EasyMock;
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.BindingManager;
+import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory;
+import org.objectweb.celtix.bus.bindings.soap.SOAPClientBinding;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CeltixInvokerTestCase extends TestCase {
+
+ public void testProcessingInputWithoutInOut() throws Exception {
+ String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
+ String operationName = "greetMe";
+ ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl();
+ CeltixInvoker invoker = createCeltixInvoker(wsdlLocation,
+ operationName, inputCtx);
+
+ Object[] args = new Object[1];
+ args[0] = new String("hello");
+ invoker.invokeTarget(args, CeltixInvoker.NONE);
+
+ // Check the input object after processing is correct
+ // Should be no change for input if only IN parameters involved
+ Object[] myrtn = (Object[]) inputCtx.getMessageObjects();
+
+ assertEquals("hello", myrtn[0]);
+ }
+
+ public void testProcessingInputWithInOut() throws Exception {
+ String wsdlLocation = "/wsdl/hello_world_doc_lit_inout.wsdl";
+ String operationName = "greetMe";
+ ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl();
+ CeltixInvoker invoker = createCeltixInvoker(wsdlLocation,
+ operationName, inputCtx);
+
+ Object[] args = new Object[1];
+ String inputvalue = new String("hello");
+ args[0] = inputvalue;
+ Object result = invoker.invokeTarget(args, CeltixInvoker.NONE);
+
+ // Check the input object after processing is correct
+ // input should be wrapped as Holder type if it is INOUT parameter
+ Object[] myrtn = (Object[]) inputCtx.getMessageObjects();
+
+ //FIXME: this does not work for the wrapped doc/lit case due to a bug in Celtix
+ //assertTrue("input is not Holder type", myrtn[0] instanceof Holder);
+ }
+
+ // NOTE: For convenience this method presumes the soap service name is
+ // SOAPService and port name is SoapPort
+ private CeltixInvoker createCeltixInvoker(String wsdlLocation,
+ String operationName,
+ ObjectMessageContextImpl inputCtx)
+ throws Exception {
+
+ // Make following call to return a mocked SOAPClientBinding:
+ // bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference)
+ SOAPClientBinding clientBinding = EasyMock
+ .createMock(SOAPClientBinding.class);
+ clientBinding.createObjectContext();
+ EasyMock.expectLastCall().andReturn(inputCtx);
+ clientBinding.invoke(EasyMock.isA(ObjectMessageContextImpl.class),
+ EasyMock.isA(SCADataBindingCallback.class));
+ EasyMock.expectLastCall().andReturn(new ObjectMessageContextImpl());
+ EasyMock.replay(clientBinding);
+
+ SOAPBindingFactory bindingFactory = EasyMock.createNiceMock(SOAPBindingFactory.class);
+ bindingFactory.createClientBinding(EasyMock.isA(EndpointReferenceType.class));
+ EasyMock.expectLastCall().andReturn(clientBinding);
+ EasyMock.replay(bindingFactory);
+
+ BindingManager bindingManager = EasyMock.createNiceMock(BindingManager.class);
+ String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
+ bindingManager.getBindingFactory(bindingId);
+ EasyMock.expectLastCall().andReturn(bindingFactory);
+
+ Bus bus = EasyMock.createNiceMock(Bus.class);
+ bus.getBindingManager();
+ EasyMock.expectLastCall().andReturn(bindingManager);
+ EasyMock.replay(bindingManager);
+ EasyMock.replay(bus);
+
+ // Create WSDL Definition
+ URL url = getClass().getResource(wsdlLocation);
+ assertNotNull("Could not find wsdl " + url.toString(), url);
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ InputSource input = new InputSource(url.openStream());
+ Definition wsdlDef = reader.readWSDL(url.toString(), input);
+ QName qName = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService");
+ Service wsdlService = wsdlDef.getService(qName);
+ Port port = wsdlService.getPort("SoapPort");
+
+ return new CeltixInvoker(operationName, bus, port, wsdlService, wsdlDef, null);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
new file mode 100644
index 0000000000..c667ed2ba2
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.xml.sax.InputSource;
+
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.BindingManager;
+import static org.objectweb.celtix.bindings.DataBindingCallback.Mode.PARTS;
+import org.objectweb.celtix.bindings.ServerBindingEndpointCallback;
+import org.objectweb.celtix.bindings.ServerDataBindingCallback;
+import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory;
+import org.objectweb.celtix.bus.bindings.soap.SOAPServerBinding;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CeltixServiceTestCase extends TestCase {
+
+ public void testGetDataBindingCallback() throws Exception {
+ CeltixServiceBinding celtixService = createCeltixService();
+ Message msg = new MessageImpl();
+ msg.setBody("Hello Celtix");
+ Interceptor interceptor = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(interceptor.invoke(EasyMock.isA(Message.class))).andReturn(msg);
+ EasyMock.replay(interceptor);
+ InboundInvocationChain chain = EasyMock.createMock(InboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
+ EasyMock.replay(chain);
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ Operation<?> op = new Operation<Type>("greetMe", null, null, null);
+ chains.put(op, chain);
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getInvocationChains()).andReturn(chains);
+ EasyMock.replay(wire);
+ celtixService.setInboundWire(wire);
+ QName operationName = new QName("greetMe");
+ ObjectMessageContextImpl ctx = new ObjectMessageContextImpl();
+ ctx.setMessageObjects(new String[]{"Celtix"});
+ ServerDataBindingCallback callback1 = celtixService.getDataBindingCallback(operationName, ctx, PARTS);
+ assertNotNull(callback1);
+
+ callback1.invoke(ctx);
+ Message rtn = (Message) ctx.getReturn();
+ assertEquals("Hello Celtix", rtn.getBody());
+
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private CeltixServiceBinding createCeltixService() throws Exception {
+ //Make following call to return a mocked SOAPClientBinding:
+ //bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference)
+ SOAPServerBinding serverBinding = EasyMock.createMock(SOAPServerBinding.class);
+ serverBinding.activate();
+ EasyMock.replay(serverBinding);
+
+ //ServerBindingEndpointCallback callback = EasyMock.createNiceMock(ServerBindingEndpointCallback.class);
+
+ SOAPBindingFactory bindingFactory = EasyMock.createNiceMock(SOAPBindingFactory.class);
+ bindingFactory.createServerBinding(EasyMock.isA(EndpointReferenceType.class),
+ EasyMock.isA(ServerBindingEndpointCallback.class));
+ EasyMock.expectLastCall().andReturn(serverBinding);
+ EasyMock.replay(bindingFactory);
+
+ BindingManager bindingManager = EasyMock.createNiceMock(BindingManager.class);
+ String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
+ bindingManager.getBindingFactory(bindingId);
+ EasyMock.expectLastCall().andReturn(bindingFactory);
+
+ Bus bus = EasyMock.createNiceMock(Bus.class);
+ bus.getBindingManager();
+ EasyMock.expectLastCall().andReturn(bindingManager);
+ EasyMock.replay(bindingManager);
+ EasyMock.replay(bus);
+
+ //Create WSDL Definition
+ String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
+ URL url = getClass().getResource(wsdlLocation);
+ assertNotNull("Could not find wsdl " + url.toString(), url);
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ InputSource input = new InputSource(url.openStream());
+ Definition wsdlDef = reader.readWSDL(url.toString(), input);
+ Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
+ "SOAPService"));
+ Port port = wsdlService.getPort("SoapPort");
+
+ WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
+
+ //Create mocked InboundWire, for ServiceBindingExtension.getInterface()
+ InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+ JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+ EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+ EasyMock.replay(inboundWire);
+
+ //Create mocked WireService, for ServiceBindingExtension.getServiceInstance()
+ WireService wireService = EasyMock.createNiceMock(WireService.class);
+ wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class));
+ EasyMock.expectLastCall().andReturn(new GreeterImpl()).anyTimes();
+ EasyMock.replay(wireService);
+
+ CeltixServiceBinding celtixService = new CeltixServiceBinding("name", null, wsBinding, bus, null);
+ //Not sure how InboundWire is set to CeltixServiceBinding, is the following way correct?
+ celtixService.setInboundWire(inboundWire);
+ celtixService.start();
+
+ return celtixService;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java
new file mode 100644
index 0000000000..56de472774
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+public interface Greeter {
+ java.lang.String sayHi();
+
+ java.lang.String greetMe(
+ java.lang.String requestType
+ );
+
+ void greetMeOneWay(
+ java.lang.String requestType
+ );
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java
new file mode 100644
index 0000000000..38237ad81a
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.celtix;
+
+public class GreeterImpl implements Greeter {
+ public java.lang.String sayHi() {
+ return "sayHi";
+ }
+
+ public java.lang.String greetMe(String requestType) {
+ return "Hello " + requestType;
+ }
+
+ public void greetMeOneWay(String requestType) {
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl
new file mode 100644
index 0000000000..e8767988f3
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http"
+ xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+ elementFormDefault="qualified">
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="tns:MyStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeRequest">
+ <wsdl:part name="in" element="x1:pingMe"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeResponse">
+ <wsdl:part name="out" element="x1:pingMeResponse"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeFault">
+ <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+ <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+ <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="pingMeFault">
+ <soap:fault name="pingMeFault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:serviceDefinition name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:serviceDefinition>
+</wsdl:definitions>
+
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl
new file mode 100644
index 0000000000..d1488f987a
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http"
+ xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+ elementFormDefault="qualified">
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="tns:MyStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl
new file mode 100644
index 0000000000..76f6d8df09
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http"
+ xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+ elementFormDefault="qualified">
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="tns:MyStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMe" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeRequest">
+ <wsdl:part name="in" element="x1:pingMe"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeResponse">
+ <wsdl:part name="out" element="x1:pingMeResponse"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeFault">
+ <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+ <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+ <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="pingMeFault">
+ <soap:fault name="pingMeFault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
diff --git a/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml b/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml
new file mode 100644
index 0000000000..df8a9483d5
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml
@@ -0,0 +1,288 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+Checks to make sure the code meets the Tuscany coding guidelines
+http://java.sun.com/docs/codeconv/index.html
+
+It also enforces aa bunch of other "BestPractices like method
+lengths, if/try depths, etc...
+
+-->
+
+<module name="Checker">
+ <property name="severity"
+ value="${checkstyle.severity}"
+ default="warning"/>
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!--<module name="StrictDuplicateCode"/>-->
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <!--
+ <module name="PackageHtml"/>
+ <module name="JavadocMethod"/>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="AbstractClassName">
+ <property name="format"
+ value="^Abstract.*$|^.*Factory$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/>
+ </module>
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+ <!-- Header checks -->
+ <!-- <module name="Header"/> -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport">
+ <property name="excludes"
+ value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/>
+ </module>
+ <module name="IllegalImport"/>
+ <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <module name="ImportOrder">
+ <property name="groups" value="java,javax,org.w3c,org.xml,w3c"/>
+ <property name="ordered" value="true"/>
+ </module>
+ <!--
+ <module name="ImportControl">
+ <property name="file" value="etc/import-control.xml"/>
+ </module>
+ -->
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="AnonInnerLength">
+ <property name="max" value="40"/>
+ </module>
+ <module name="ExecutableStatementCount">
+ <property name="max" value="50"/>
+ </module>
+ <module name="FileLength"/>
+ <module name="LineLength">
+ <property name="max" value="115"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="150"/>
+ <property name="countEmpty" value="false"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="7"/>
+ </module>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="EmptyForInitializerPad"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter">
+ <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+ </module>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="TabCharacter"/>
+ <module name="WhitespaceAfter">
+ <property name="tokens" value="COMMA, SEMI"/>
+ </module>
+ <module name="WhitespaceAround">
+ <property name="tokens"
+ value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/>
+ </module>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true"/>
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!--<module name="ArrayTrailingComma"/>-->
+ <!--<module name="AvoidInlineConditionals"/>-->
+ <module name="CovariantEquals"/>
+ <module name="DoubleCheckedLocking"/>
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <!--<module name="FinalLocalVariable"/>-->
+ <module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true"/>
+ <property name="ignoreSetter" value="true"/>
+ <property name="ignoreAbstractMethods" value="true"/>
+ </module>
+ <module name="IllegalInstantiation"/>
+ <!--<module name="IllegalToken"/>-->
+ <!--<module name="IllegalTokenText"/>-->
+ <!--<module name="InnerAssignment"/>-->
+ <!--<module name="MagicNumber"/>-->
+ <module name="MissingSwitchDefault"/>
+ <module name="ModifiedControlVariable"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="StringLiteralEquality"/>
+ <module name="NestedIfDepth">
+ <property name="max" value="3"/>
+ </module>
+ <module name="NestedTryDepth">
+ <property name="max" value="3"/>
+ </module>
+ <module name="SuperClone"/>
+ <module name="SuperFinalize"/>
+ <!--<module name="IllegalCatch"/>-->
+ <module name="IllegalThrows">
+ <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/>
+ </module>
+ <!--<module name="RedundantThrows"/>-->
+ <module name="PackageDeclaration"/>
+ <module name="JUnitTestCase"/>
+ <module name="ReturnCount">
+ <property name="max" value="6"/>
+ </module>
+
+ <module name="IllegalType">
+ <property name="format" value="^xxx$"/>
+ </module>
+ <module name="DeclarationOrder"/>
+ <!--<module name="ParameterAssignment"/>-->
+ <module name="ExplicitInitialization"/>
+ <module name="DefaultComesLast"/>
+ <!--<module name="MissingCtor"/>-->
+ <module name="FallThrough"/>
+ <!--<module name="MultipleStringLiterals"/>-->
+ <module name="MultipleVariableDeclarations"/>
+ <!--<module name="RequireThis"/>-->
+ <module name="UnnecessaryParentheses"/>
+
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--<module name="DesignForExtension"/>-->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <module name="MutableException"/>
+ <module name="ThrowsCount">
+ <property name="max" value="5"/>
+ </module>
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true"/>
+ <property name="packageAllowed" value="true"/>
+ </module>
+
+
+ <!-- Metrics checks. -->
+ <!-- See http://checkstyle.sf.net/config_metrics.html -->
+ <module name="BooleanExpressionComplexity">
+ <property name="max" value="6"/>
+ </module>
+ <!--<module name="ClassDataAbstractionCoupling"/>-->
+ <!--<module name="ClassFanOutComplexity"/>-->
+ <!--<module name="CyclomaticComplexity"/>-->
+ <!--<module name="NPathComplexity"/>-->
+ <module name="JavaNCSS">
+ <property name="methodMaximum" value="75"/>
+ </module>
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ -->
+ <!--
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <module name="TodoComment">
+ <property name="format" value="WARNING"/>
+ </module>
+
+ <module name="UpperEll"/>
+
+ <!--Assert statement may have side effects:-->
+ <module name="DescendantToken">
+ <property name="tokens" value="LITERAL_ASSERT"/>
+ <property name="limitedTokens"
+ value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/>
+ <property name="maximumNumber" value="0"/>
+ </module>
+
+ <!--<module name="UncommentedMain"/>-->
+ <module name="TrailingComment"/>
+ <module name="Indentation">
+ <property name="caseIndent" value="0"/>
+ </module>
+ <!--<module name="RequiredRegexp">-->
+ </module>
+
+</module>
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off
new file mode 100644
index 0000000000..697232e97f
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworldws-celtix</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Celtix Web Service Sample</name>
+ <description>A sample HelloWorld Web Service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>core</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${tuscanyVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>celtix</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm
new file mode 100644
index 0000000000..6d3210d097
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <!-- * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License. -->
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Tuscany Hello World Celtix Web Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --><!-- maven -->
+ <style type="text/css" media="all">
+ @import url("../../../../css/maven-base.css");
+ @import url("../../../../css/maven-theme.css");
+ @import url("../../../../css/site.css");
+ </style>
+ <link rel="stylesheet" href="./css/print.css" type="text/css" media="print">
+ <!-- end maven -->
+</head>
+ <body>
+ <h2>Tuscany Hello World Celtix Web service Sample</h2> <h3>Overview</h3>
+ <p>
+ The Tuscany hello world Celtix Web service sample shows using the Tuscany SCA runtime as a standalone web service.
+ </p>
+ <h3>Location</h3> This sample is located &nbsp;in the samples\sca\helloworldws-celtix
+ directory.<br>
+
+
+ <h3>Setup</h3>This sample depends on the Tuscany runtime, Celtix, and the sample jar,
+
+ <span style="font-weight: bold;">
+ sample-helloworldws-celtix-incubating-M1.jar
+ </span>
+
+, all of these must be available on the classpath to run the sample.
+
+<h3>Running</h3>
+
+ In the directory samples/sca/helloworldws-celtix use the JDK 1.5 java command to run the class helloworld.HelloWorldServer
+
+ <pre>Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre>
+ <pre>Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre>
+
+ <h3>Code Overview</h3> The source files are physically organized as shown below:<br>
+ <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td>
+ <pre>
+ +---main
+ +---java
+ &brvbar; +---helloworld
+ &brvbar; HelloWorldServer.java
+ &brvbar; HelloWorldImpl.java
+ &brvbar; HelloWorldService.java
+ +---resources
+ &brvbar; sca.module
+ +---wsdl
+ helloworld.wsdl
+ </pre>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <br>
+ <br>
+ <table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td>HelloWorldServer.java</td>
+ <td>Main method to startup the Tuscany runtime which will startup the services defined in sca.module</td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top;">HelloWorldService.java</td>
+ <td>Defines the Java interface implemented by the component.</td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top;">HelloWorldImpl.java</td>
+ <td>Implements the SCA component. Uses the SCA service annotation
+ tag on the class to show what SCA interface is being implemented.</td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top; height: 62px;">sca.module</td>
+ <td style="height: 62px;">Defines the SCA module, entryPoint and component.
+ Defines for the HelloWorldServiceComponent component and the Java class that
+ implements the component For the entryPoint it defines WSDL for the service, the
+ Java interface provided by the service, and wires the service to the&nbsp;HelloWorldServiceComponent</td>
+ </tr>
+ <tr>
+ <td>helloworld.wsdl</td>
+ <td>WSDL for the service.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h3>Instrumentation</h3>
+ You can instrument Celtix runtime using Celtix management facilities.
+ Information in the Celtix configuration file is used to configure the behavior of Celtix management facilities.
+ When JMX is enabled, Celtix instrumentation info is exported through the JMX MBeanServer. To enable JMX (
+ JMX is disabled in Celtix by default), you need to pass in a Celtix configuration file by running the sample using command below:
+ <br>
+ <br>
+
+ In the directory samples/sca/helloworldws-celtix use the JDK 1.5 java command to run the class helloworld.HelloWorldServer
+
+ <pre>Linux: java -Dceltix.config.file=file:///&lt;Tuscany-installation-dir&gt;/samples/sca/helloworldws-celtix/server.xml -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre>
+ <pre>Windows: java -Dceltix.config.file=file:///&lt;Tuscany-installation-dir&gt;/samples/sca/helloworldws-celtix/server.xml -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre>
+
+&lt;Tuscany-installation-dir&gt; is the location where Tuscany installed.
+ <br>
+ <br>
+
+You can use jconsole, which comes with JDK1.5, to explore the Celtix managed components:
+
+ <pre>jconsole</pre>
+
+ The server JMX Service URL is:
+ <pre>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server</pre>
+
+
+NOTE: Enter the JMX service URL as above, leave the username and password empty in this sample.
+ <br>
+ <br>
+
+Further information about Celtix instrumentation can be found from Celtix "Using Celtix Management" manual and Celtix management sample.
+
+
+<br>
+ </body>
+</html> \ No newline at end of file
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat
new file mode 100755
index 0000000000..fa24c84328
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat
@@ -0,0 +1,10 @@
+echo on
+rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y
+mkdir target\standalone
+pushd target\standalone
+jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip"
+jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT-bin.zip"
+popd
+move target\standalone\extension\*.jar target\standalone\boot
+copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT.jar" target\standalone\extension
+java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldws-celtix\1.0-SNAPSHOT\sample-helloworldws-celtix-1.0-SNAPSHOT.jar" %*
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml
new file mode 100644
index 0000000000..94c9efe897
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans SYSTEM
+ "http://celtix.objectweb.org/configuration/spring/celtix-spring-beans.dtd">
+
+<beans
+ xmlns:ct="http://celtix.objectweb.org/configuration/types"
+ xmlns:sec="http://celtix.objectweb.org/bus/configuration/security"
+ xmlns:im-conf="http://celtix.objectweb.org/bus/instrumentation/instrumentation-config"
+ xmlns:im="http://celtix.objectweb.org/bus/instrumentation"
+>
+
+ <bean id="celtix.Instrumentation"
+ class="org.objectweb.celtix.bus.instrumentation.instrumentation_config.spring.InstrumentationConfigBean">
+ <property name="instrumentationControl">
+ <value>
+ <im:instrumentation>
+ <im:InstrumentationEnabled>true</im:InstrumentationEnabled>
+ <im:JMXEnabled>true</im:JMXEnabled>
+ </im:instrumentation>
+ </value>
+ </property>
+ <property name="MBServer">
+ <value>
+ <im:MBServer>
+ <im:JMXConnector>
+ <im:Threaded>true</im:Threaded>
+ <im:Daemon>false</im:Daemon>
+ <im:JMXServiceURL>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server</im:JMXServiceURL>
+ </im:JMXConnector>
+ </im:MBServer>
+ </value>
+ </property>
+ </bean>
+</beans>
+
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..f9781fb48d
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the Eager Init service and invoke it.
+ */
+public final class HelloWorldClient {
+ private HelloWorldClient() {
+ }
+
+ public static void main(String[] args) throws Exception {
+ String name = "World";
+
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+
+ // Locate the Eager init service
+ HelloWorldService helloWorldService =
+ compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ // Invoke the HelloWorld service
+ String value = helloWorldService.getGreetings(name);
+
+ System.out.println(value);
+ System.out.flush();
+
+ }
+}
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..8f23acd645
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+}
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..281cdd37ab
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworldws">
+
+ <service name="HelloWorldWebService" target="http:///foo">
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/ -->
+ <interface.java interface="helloworld.HelloWorldService"/>
+
+
+<!--FIXME the location attribute is a really bad hack here! does not follow to spec at all
+-->
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1"
+ location="wsdl/helloworld.wsdl"
+ />
+
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..21781bfc7f
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,77 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/binding-celtix/sunjars/build.xml b/sandbox/old/contrib/binding-celtix/sunjars/build.xml
new file mode 100644
index 0000000000..e6fec45356
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/sunjars/build.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="CeltixSunJarsInstaller">
+ <target name="checkinstalled">
+ <condition property="already.installed" >
+ <and>
+ <available file="${localRepository}/javax/annotation/jsr250-api/2.0-JAXWS-2.0-EA3/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/>
+ <available file="${localRepository}/javax/jws/jsr181-api/2.0-JAXWS-2.0-EA3/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/>
+ <available file="${localRepository}/javax/xml/jaxws-api/2.0-JAXWS-2.0-EA3/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/>
+ <available file="${localRepository}/com/sun/xml/saaj-impl/1.3/saaj-impl-1.3.jar"/>
+ <available file="${localRepository}/javax/xml/saaj-api/1.3/saaj-api-1.3.jar"/>
+ </and>
+ </condition>
+ <condition property="maven.suffix" value="">
+ <os family="unix"/>
+ </condition>
+ <condition property="maven.suffix" value=".bat">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <target name="installJars" depends="checkinstalled" unless="already.installed">
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=javax.annotation -DartifactId=jsr250-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/>
+ </exec>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=javax.jws -DartifactId=jsr181-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/>
+ </exec>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=javax.xml -DartifactId=jaxws-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/>
+ </exec>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=javax.xml -DartifactId=saaj-api -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-api-1.3.jar"/>
+ </exec>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.sun.xml -DartifactId=saaj-impl -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-impl-1.3.jar"/>
+ </exec>
+ </target>
+</project>
diff --git a/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off b/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off
new file mode 100644
index 0000000000..6ec8efb384
--- /dev/null
+++ b/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sunjars</artifactId>
+ <packaging>pom</packaging>
+ <name>Project to install the Sun jars</name>
+
+ <properties>
+ <celtix.version>1.0</celtix.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>objectweb</id>
+ <name>ObjectWeb repo</name>
+ <url>http://maven.objectweb.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <!-- This is a "hack" to overcome the Sun jar issue. Basically, we download a
+ complete celtix install kit (epl version) and then extract the Sun jars that we
+ need and install them. We use the dependency plugin to download it from the
+ objectweb snapshot mirror, then use antrun to fork a build.xml that will conditionally
+ call mvn to install the jars if they aren't already there. -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>getdeps</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/celtix-install</outputDirectory>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.objectweb.celtix</groupId>
+ <artifactId>celtix-distribution</artifactId>
+ <version>${celtix.version}</version>
+ <classifier>bin-epl</classifier>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant target="installJars">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/contrib/binding-hessian/binding/LICENSE.txt b/sandbox/old/contrib/binding-hessian/binding/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/binding-hessian/binding/NOTICE.txt b/sandbox/old/contrib/binding-hessian/binding/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/binding-hessian/binding/pom.xml.off b/sandbox/old/contrib/binding-hessian/binding/pom.xml.off
new file mode 100755
index 0000000000..8c34615f7f
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/pom.xml.off
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.hessian</groupId>
+ <artifactId>hessian</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.hessian</groupId>
+ <artifactId>hessian-binding</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <name>Apache Tuscany Hessian Binding</name>
+ <description></description>
+ <packaging>jar</packaging>
+</project>
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java
new file mode 100644
index 0000000000..45b108e4b4
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.spi.wire.Message;
+
+/**
+ * Channels dispatch service invocations over a transport
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Channel {
+
+ /**
+ * Dispatches the service invocation
+ *
+ * @param operation the service operation to invoke
+ * @param returnType the expected return type or null
+ * @param message the message containing the invocation payload
+ * @return the response message
+ * @throws InvocationException if an error occurs during the invocation
+ */
+ Message send(String operation, Class<?> returnType, Message message) throws InvocationException;
+
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java
new file mode 100644
index 0000000000..a7622f86e8
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import com.caucho.hessian.io.AbstractHessianInput;
+import com.caucho.hessian.io.AbstractHessianOutput;
+
+/**
+ * Responsible for receiving invocations for a service endpoint from a transport
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Destination {
+
+ /**
+ * Dispatches to the service endpoint
+ *
+ * @param in the input stream containing the invocation payload
+ * @param out the output stream to write the response to
+ * @throws InvocationException if an error occurs invoking the service
+ */
+ void invoke(AbstractHessianInput in, AbstractHessianOutput out) throws InvocationException;
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java
new file mode 100644
index 0000000000..316920d6dd
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+/**
+ * Thrown when an error creating a destination is encountered
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class DestinationCreationException extends WiringException {
+
+ public DestinationCreationException(String message) {
+ super(message);
+ }
+
+ protected DestinationCreationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java
new file mode 100644
index 0000000000..fbde279be0
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Base checked exception for the Hessian binding extension
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class HessianException extends TuscanyException {
+ protected HessianException() {
+ }
+
+ protected HessianException(String message) {
+ super(message);
+ }
+
+ protected HessianException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected HessianException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected HessianException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected HessianException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java
new file mode 100644
index 0000000000..aa116293c1
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class InvalidDestinationException extends WiringException {
+ public InvalidDestinationException(String message, Throwable cause) {
+ super(message, null, null, cause);
+ }
+
+ public InvalidDestinationException(String message, String identifier) {
+ super(message, identifier, null, null);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java
new file mode 100644
index 0000000000..7456d1baa8
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Raised when an error performing a service invocation is encountered
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class InvocationException extends TuscanyException {
+
+ public InvocationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvocationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public InvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvocationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java
new file mode 100644
index 0000000000..53eb5f46b3
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+
+/**
+ * Dispatches a service invocation to a Channel
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvokerInterceptor implements Interceptor {
+ private String operation;
+ private Channel channel;
+
+ /**
+ * Creates the interceptor.
+ *
+ * @param operation the service operation the interceptor dispatches for
+ * @param channel the channel to dispatch to
+ */
+ public InvokerInterceptor(String operation, Channel channel) {
+ this.operation = operation;
+ this.channel = channel;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ return channel.send(operation, null, msg);
+ } catch (InvocationException e) {
+ msg.setBodyWithFault(e);
+ return 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;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java
new file mode 100644
index 0000000000..195642019e
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java
@@ -0,0 +1,28 @@
+package org.apache.tuscany.hessian;/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class ServletHostNotFoundException extends DestinationCreationException {
+ public ServletHostNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java
new file mode 100644
index 0000000000..a2d417ff58
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian;
+
+/**
+ * Denotes a missing or not found type
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class TypeNotFoundException extends DestinationCreationException {
+
+ public TypeNotFoundException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java
new file mode 100644
index 0000000000..e6077e8003
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.channel;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import com.caucho.hessian.client.HessianRuntimeException;
+import com.caucho.hessian.io.HessianInput;
+import com.caucho.hessian.io.HessianOutput;
+import org.apache.tuscany.hessian.Channel;
+import org.apache.tuscany.hessian.InvocationException;
+
+/**
+ * A channel implementation that uses HTTP as the transport protocol
+ *
+ * @version $Rev$ $Date$
+ */
+public class HttpChannel implements Channel {
+ private URL destinationUrl;
+ private boolean chunkedPost;
+ private String basicAuth;
+ private String user;
+ private String password;
+ private int readTimeout;
+
+ public HttpChannel(URL url) {
+ this.destinationUrl = url;
+ }
+
+ public Message send(String operation, Class<?> returnType, Message message) throws InvocationException {
+ URLConnection conn;
+ try {
+ conn = openConnection(destinationUrl);
+ } catch (IOException e) {
+ throw new InvocationException(e);
+ }
+ if (chunkedPost && conn instanceof HttpURLConnection) {
+ HttpURLConnection httpConn = (HttpURLConnection) conn;
+ httpConn.setChunkedStreamingMode(8 * 1024);
+ }
+
+ OutputStream os;
+ try {
+ os = conn.getOutputStream();
+ } catch (IOException e) {
+ throw new HessianRuntimeException(e);
+ }
+
+ try {
+ HessianOutput out = new HessianOutput(os);
+ Object[] args;
+ Object payload = message.getBody();
+ if (payload != null && !payload.getClass().isArray()) {
+ args = new Object[]{payload};
+ } else {
+ args = (Object[]) payload;
+ }
+ out.call(operation, args);
+ out.flush();
+
+ InputStream is = null;
+ if (conn instanceof HttpURLConnection) {
+ HttpURLConnection httpConn = (HttpURLConnection) conn;
+ int code = httpConn.getResponseCode();
+ if (code != 200) {
+ StringBuffer sb = new StringBuffer();
+ int ch;
+
+ try {
+ is = httpConn.getInputStream();
+
+ if (is != null) {
+ while ((ch = is.read()) >= 0) {
+ sb.append((char) ch);
+ }
+
+ is.close();
+ }
+
+ is = httpConn.getErrorStream();
+ if (is != null) {
+ while ((ch = is.read()) >= 0) {
+ sb.append((char) ch);
+ }
+ }
+ } catch (FileNotFoundException e) {
+ throw new InvocationException(e);
+ } catch (IOException e) {
+ if (is == null) {
+ throw new InvocationException("Invocation exception", String.valueOf(code), e);
+ }
+ }
+
+ if (is != null) {
+ is.close();
+ }
+ throw new InvocationException("Invocation exception", sb.toString());
+ }
+ }
+ is = conn.getInputStream();
+
+ HessianInput in = new HessianInput(is);
+ // FIXME handle faults
+ Object reply = in.readReply(returnType);
+ Message msg = new MessageImpl();
+ msg.setBody(reply);
+ return msg;
+ } catch (RuntimeException e) {
+ if (conn instanceof HttpURLConnection) {
+ ((HttpURLConnection) conn).disconnect();
+ }
+ throw e;
+ } catch (Throwable e) {
+ if (conn instanceof HttpURLConnection) {
+ ((HttpURLConnection) conn).disconnect();
+ }
+
+ throw new InvocationException(e);
+ }
+ }
+
+ protected URLConnection openConnection(URL url) throws IOException {
+ URLConnection conn = url.openConnection();
+
+ conn.setDoOutput(true);
+
+ if (readTimeout > 0) {
+ conn.setReadTimeout(readTimeout);
+ }
+
+ conn.setRequestProperty("Content-Type", "x-application/hessian");
+
+ if (basicAuth != null)
+ conn.setRequestProperty("Authorization", basicAuth);
+ else if (user != null && password != null) {
+ basicAuth = "Basic " + base64(user + ":" + password);
+ conn.setRequestProperty("Authorization", basicAuth);
+ }
+
+ return conn;
+ }
+
+ private String base64(String value) {
+ StringBuffer cb = new StringBuffer();
+
+ int i = 0;
+ for (i = 0; i + 2 < value.length(); i += 3) {
+ long chunk = (int) value.charAt(i);
+ chunk = (chunk << 8) + (int) value.charAt(i + 1);
+ chunk = (chunk << 8) + (int) value.charAt(i + 2);
+
+ cb.append(encode(chunk >> 18));
+ cb.append(encode(chunk >> 12));
+ cb.append(encode(chunk >> 6));
+ cb.append(encode(chunk));
+ }
+
+ if (i + 1 < value.length()) {
+ long chunk = (int) value.charAt(i);
+ chunk = (chunk << 8) + (int) value.charAt(i + 1);
+ chunk <<= 8;
+
+ cb.append(encode(chunk >> 18));
+ cb.append(encode(chunk >> 12));
+ cb.append(encode(chunk >> 6));
+ cb.append('=');
+ } else if (i < value.length()) {
+ long chunk = (int) value.charAt(i);
+ chunk <<= 16;
+
+ cb.append(encode(chunk >> 18));
+ cb.append(encode(chunk >> 12));
+ cb.append('=');
+ cb.append('=');
+ }
+
+ return cb.toString();
+ }
+
+ public static char encode(long d) {
+ d &= 0x3f;
+ if (d < 26)
+ return (char) (d + 'A');
+ else if (d < 52)
+ return (char) (d + 'a' - 26);
+ else if (d < 62)
+ return (char) (d + '0' - 52);
+ else if (d == 62)
+ return '+';
+ else
+ return '/';
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java
new file mode 100644
index 0000000000..783750940a
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.channel;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import com.caucho.hessian.io.HessianInput;
+import com.caucho.hessian.io.HessianOutput;
+import org.apache.tuscany.hessian.Channel;
+import org.apache.tuscany.hessian.InvocationException;
+import org.apache.tuscany.hessian.destination.LocalDestination;
+
+/**
+ * A channel implementation that uses an in-VM transport
+ *
+ * @version $Rev$ $Date$
+ */
+public class LocalChannel implements Channel {
+ private LocalDestination destination;
+
+ public LocalChannel(LocalDestination destination) {
+ this.destination = destination;
+ }
+
+ public Message send(String operation, Class<?> returnType, Message message) throws InvocationException {
+ Object payload = message.getBody();
+ Object[] args;
+ if (payload != null && !payload.getClass().isArray()) {
+ args = new Object[]{payload};
+ } else {
+ args = (Object[]) payload;
+ }
+ try {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ HessianOutput output = new HessianOutput(baos);
+ output.call(operation, args);
+ output.close();
+ ByteArrayInputStream bas = new ByteArrayInputStream(baos.toByteArray());
+ HessianInput input = new HessianInput(bas);
+
+ ByteArrayOutputStream returnOutputStream = new ByteArrayOutputStream();
+ HessianOutput returnOutput = new HessianOutput(returnOutputStream);
+ destination.invoke(input, returnOutput);
+ ByteArrayInputStream returnStream = new ByteArrayInputStream(returnOutputStream.toByteArray());
+ HessianInput in = new HessianInput(returnStream);
+ // FIXME handle faults
+ Object reply = in.readReply(returnType);
+ Message msg = new MessageImpl();
+ msg.setBody(reply);
+ return msg;
+ } catch (Throwable e) {
+ throw new InvocationException(e);
+ }
+
+
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java
new file mode 100644
index 0000000000..8ae69bfb46
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.component;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.hessian.Channel;
+import org.apache.tuscany.hessian.DestinationCreationException;
+import org.apache.tuscany.hessian.InvalidDestinationException;
+import org.apache.tuscany.hessian.InvokerInterceptor;
+import org.apache.tuscany.hessian.ServletHostNotFoundException;
+import org.apache.tuscany.hessian.channel.HttpChannel;
+import org.apache.tuscany.hessian.channel.LocalChannel;
+import org.apache.tuscany.hessian.destination.HttpDestination;
+import org.apache.tuscany.hessian.destination.LocalDestination;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Binding component for hessian transport.
+ */
+public class HessianBindingComponent {
+
+ public static String LOCAL_SCHEME = "hessianLocal";
+ public static String HTTP_SCHEME = "http";
+ private URI uri;
+ private ServletHost servletHost;
+ private Map<URI, LocalDestination> destinations;
+
+ public HessianBindingComponent(@Property(name = "uri")
+ URI uri, @Reference(name = "servletHost")
+ ServletHost host) {
+ this.uri = uri;
+ this.servletHost = host;
+ destinations = new HashMap<URI, LocalDestination>();
+ }
+
+ public void createEndpoint(URI endpointUri, Wire wire, ClassLoader loader) throws DestinationCreationException {
+ if (LOCAL_SCHEME.equals(endpointUri.getScheme())) {
+ LocalDestination destination = new LocalDestination(wire, loader);
+ destinations.put(uri, destination);
+ } else if (HTTP_SCHEME.equals(endpointUri.getScheme())) {
+ if (servletHost == null) {
+ throw new ServletHostNotFoundException("ServletHost is was not found");
+ }
+ HttpDestination destination = new HttpDestination(wire, loader);
+ // FIXME mapping
+ servletHost.registerMapping(endpointUri.getPath(), destination);
+ } else {
+ throw new UnsupportedOperationException("Unsupported scheme");
+ }
+ }
+
+ public void bindToEndpoint(URI endpointUri, Wire wire) throws InvalidDestinationException {
+ Channel channel = createChannel(endpointUri);
+ for (Map.Entry<PhysicalOperationDefinition, InvocationChain> entry : wire.getPhysicalInvocationChains()
+ .entrySet()) {
+ String name = entry.getKey().getName();
+ InvokerInterceptor interceptor = new InvokerInterceptor(name, channel);
+ entry.getValue().addInterceptor(interceptor);
+ }
+ }
+
+ /**
+ * Creates a Channel to the service at the given URI
+ *
+ * @param uri the service uri
+ * @return the channel
+ * @throws InvalidDestinationException if an error is encountered creating
+ * the channel
+ */
+ private Channel createChannel(URI uri) throws InvalidDestinationException {
+ if (LOCAL_SCHEME.equals(uri.getScheme())) {
+ LocalDestination destination = destinations.get(uri);
+ if (destination != null) {
+ throw new InvalidDestinationException("Destination not found", uri.toString());
+ }
+ return new LocalChannel(destination);
+ } else if (HTTP_SCHEME.equals(uri.getScheme())) {
+ try {
+ return new HttpChannel(uri.toURL());
+ } catch (MalformedURLException e) {
+ throw new InvalidDestinationException("URI must be a valid URL ", e);
+ }
+ }
+ throw new UnsupportedOperationException("Unsupported scheme");
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java
new file mode 100644
index 0000000000..5efbefeade
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.component;
+
+import org.apache.tuscany.hessian.HessianException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class WireBindException extends HessianException {
+
+ public WireBindException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java
new file mode 100644
index 0000000000..baae50677a
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.destination;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+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 com.caucho.hessian.io.AbstractHessianInput;
+import com.caucho.hessian.io.AbstractHessianOutput;
+import org.apache.tuscany.hessian.Destination;
+import org.apache.tuscany.hessian.InvocationException;
+import org.apache.tuscany.hessian.TypeNotFoundException;
+
+/**
+ * Base implementation of a Destination
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractDestination implements Destination {
+ protected Map<String, ChainHolder> chains;
+ private ClassLoader loader;
+
+ protected AbstractDestination(Wire wire, ClassLoader loader) throws TypeNotFoundException {
+ this.loader = loader;
+ chains = new HashMap<String, ChainHolder>();
+ for (Map.Entry<PhysicalOperationDefinition, InvocationChain> entry : wire.getPhysicalInvocationChains()
+ .entrySet()) {
+ PhysicalOperationDefinition operation = entry.getKey();
+ String operationName = operation.getName();
+ InvocationChain chain = entry.getValue();
+ List<String> params = operation.getParameters();
+ Class<?>[] paramTypes = new Class<?>[params.size()];
+ // load the param types in the target's classloader
+ for (int i = 0; i < params.size(); i++) {
+ String param = params.get(i);
+ try {
+ paramTypes[i] = loader.loadClass(param);
+ } catch (ClassNotFoundException e) {
+ throw new TypeNotFoundException("Operation parameter type not found", operationName, e);
+ }
+ }
+ AbstractDestination.ChainHolder holder =
+ new AbstractDestination.ChainHolder(paramTypes, chain);
+ chains.put(operationName, holder);
+ }
+ }
+
+ public void invoke(AbstractHessianInput in, AbstractHessianOutput out) throws InvocationException {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ // ensure serialization is done on the target classloader
+ Thread.currentThread().setContextClassLoader(loader);
+ in.readCall();
+ String m = in.readMethod();
+ ChainHolder holder = chains.get(m);
+ if (holder == null) {
+ out.startReply();
+ out.writeFault("OperationNotFound", "The service has no method named: " + m, null);
+ out.completeReply();
+ return;
+ }
+ Class<?>[] paramType = holder.types;
+ Object[] values = new Object[paramType.length];
+ for (int n = 0; n < paramType.length; n++) {
+ values[n] = in.readObject(paramType[n]);
+ }
+ in.completeCall();
+ Message msg = new MessageImpl();
+ InvocationChain chain = holder.chain;
+ Message ret = chain.getHeadInterceptor().invoke(msg);
+ out.startReply();
+ Object o = ret.getBody();
+ out.writeObject(o);
+ out.completeReply();
+ } catch (IOException e) {
+ throw new InvocationException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ protected class ChainHolder {
+ Class<?>[] types;
+ InvocationChain chain;
+
+ public ChainHolder(Class<?>[] types, InvocationChain chain) {
+ this.types = types;
+ this.chain = chain;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java
new file mode 100644
index 0000000000..cd6281e8bd
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.destination;
+
+import java.io.IOException;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.tuscany.spi.wire.Wire;
+
+import com.caucho.hessian.io.HessianInput;
+import com.caucho.hessian.io.HessianOutput;
+import org.apache.tuscany.hessian.InvocationException;
+import org.apache.tuscany.hessian.TypeNotFoundException;
+
+/**
+ * A Destination implementation which receives requests over HTTP using a servlet engine
+ *
+ * @version $Rev$ $Date$
+ */
+public class HttpDestination extends AbstractDestination implements Servlet {
+
+ public HttpDestination(Wire wire, ClassLoader loader)
+ throws TypeNotFoundException {
+ super(wire, loader);
+ }
+
+ public void service(ServletRequest req, ServletResponse resp)
+ throws ServletException, IOException {
+ try {
+ invoke(new HessianInput(req.getInputStream()), new HessianOutput(resp.getOutputStream()));
+ } catch (InvocationException e) {
+ throw new ServletException(e);
+ }
+ }
+
+ public void init(ServletConfig servletConfig) throws ServletException {
+
+ }
+
+ public ServletConfig getServletConfig() {
+ return null;
+ }
+
+ public String getServletInfo() {
+ return null;
+ }
+
+ public void destroy() {
+
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java
new file mode 100644
index 0000000000..55946f96e7
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.destination;
+
+import org.apache.tuscany.spi.wire.Wire;
+
+import org.apache.tuscany.hessian.TypeNotFoundException;
+
+/**
+ * A Destination implementation which receives requests over an in-VM transport
+ *
+ * @version $Rev$ $Date$
+ */
+public class LocalDestination extends AbstractDestination {
+
+ public LocalDestination(Wire wire, ClassLoader loader) throws TypeNotFoundException {
+ super(wire, loader);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java
new file mode 100644
index 0000000000..181733973d
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.hessian.model.logical.HessianBindingDefinition;
+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.osoa.sca.annotations.Reference;
+
+/**
+ * Loader for hessian binding.
+ *
+ * @version $Revision$ $Date$
+ */
+public class HessianBindingLoader extends LoaderExtension<HessianBindingDefinition> {
+
+ /**
+ * Qualified name of the binding.
+ */
+ public static final QName BINDING_HESSIAN =
+ new QName("http://tuscany.apache.org/xmlns/binding/hessian/2.0-alpha2-incubating-SNAPSHOT", "binding.hessian");
+
+ /**
+ * Injects the loader registry.
+ *
+ * @param loaderRegistry Loader registry.
+ */
+ protected HessianBindingLoader(@Reference(name = "loaderRegistry")
+ LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ /**
+ * Gets the qualified name of the binding element.
+ */
+ @Override
+ public QName getXMLType() {
+ return BINDING_HESSIAN;
+ }
+
+ /**
+ * Loads the binding from the XML.
+ */
+ public HessianBindingDefinition load(ModelObject arg0, XMLStreamReader arg1, DeploymentContext arg2)
+ throws XMLStreamException, LoaderException {
+ // TODO populate the model object
+ return new HessianBindingDefinition();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java
new file mode 100644
index 0000000000..74c305254c
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.model.logical;
+
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class HessianBindingDefinition extends BindingDefinition {
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java
new file mode 100644
index 0000000000..e24432d513
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.model.physical;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.model.physical.PhysicalWireSourceDefinition;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HessianWireSourceDefinition extends PhysicalWireSourceDefinition {
+ private URI endpointUri;
+
+ public URI getEndpointUri() {
+ return endpointUri;
+ }
+
+ public void setEndpointUri(URI endpointUri) {
+ this.endpointUri = endpointUri;
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java
new file mode 100644
index 0000000000..52dd8728f1
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.model.physical;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.model.physical.PhysicalWireTargetDefinition;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HessianWireTargetDefinition extends PhysicalWireTargetDefinition {
+ private URI endpointUri;
+
+ public URI getEndpointUri() {
+ return endpointUri;
+ }
+
+ public void setEndpointUri(URI endpointUri) {
+ this.endpointUri = endpointUri;
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java
new file mode 100644
index 0000000000..0ca3132d11
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.wire;
+
+import java.net.URI;
+
+import org.apache.tuscany.hessian.DestinationCreationException;
+import org.apache.tuscany.hessian.InvalidDestinationException;
+import org.apache.tuscany.hessian.component.HessianBindingComponent;
+import org.apache.tuscany.hessian.model.physical.HessianWireSourceDefinition;
+import org.apache.tuscany.hessian.model.physical.HessianWireTargetDefinition;
+import org.apache.tuscany.spi.builder.physical.WireAttacher;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.wire.Wire;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HessianWireAttacher<C extends Component> implements
+ WireAttacher<C, HessianWireSourceDefinition, HessianWireTargetDefinition> {
+
+ private HessianBindingComponent bindingComponent;
+
+ public HessianWireAttacher(@Reference(name="bindingComponent") HessianBindingComponent bindingComponent) {
+ this.bindingComponent = bindingComponent;
+ }
+
+ public void attach(C source, Component target, Wire wire, HessianWireSourceDefinition definition)
+ throws DestinationCreationException {
+ URI endpointUri = definition.getEndpointUri();
+ // FIXME classloader
+ bindingComponent.createEndpoint(endpointUri, wire, null);
+
+ }
+
+ public void attach(C component, Wire wire, HessianWireTargetDefinition definition)
+ throws InvalidDestinationException {
+ URI endpointUri = definition.getEndpointUri();
+ bindingComponent.bindToEndpoint(endpointUri, wire);
+ }
+}
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/test/java/org/apache/tuscany/hessian/integration/HessianLocalSendReceiveTestCase.java b/sandbox/old/contrib/binding-hessian/binding/src/test/java/org/apache/tuscany/hessian/integration/HessianLocalSendReceiveTestCase.java
new file mode 100644
index 0000000000..f0fc6b93f0
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/binding/src/test/java/org/apache/tuscany/hessian/integration/HessianLocalSendReceiveTestCase.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.hessian.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.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.hessian.channel.LocalChannel;
+import org.apache.tuscany.hessian.destination.LocalDestination;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HessianLocalSendReceiveTestCase extends TestCase {
+
+ public void testInvokeVoidReturn() throws Exception {
+ Interceptor interceptor = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(interceptor.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl());
+ EasyMock.replay(interceptor);
+
+ PhysicalOperationDefinition operation = new PhysicalOperationDefinition();
+ operation.setName("hello");
+
+ InvocationChain chain = EasyMock.createMock(InvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
+ EasyMock.replay(chain);
+
+ Map<PhysicalOperationDefinition, InvocationChain> chains =
+ new HashMap<PhysicalOperationDefinition, InvocationChain>();
+ chains.put(operation, chain);
+
+ Wire wire = EasyMock.createMock(Wire.class);
+ EasyMock.expect(wire.getPhysicalInvocationChains()).andReturn(chains);
+ EasyMock.replay(wire);
+ ClassLoader loader = getClass().getClassLoader();
+ LocalDestination destination = new LocalDestination(wire, loader);
+ LocalChannel channel = new LocalChannel(destination);
+ channel.send("hello", null, new MessageImpl());
+ EasyMock.verify(interceptor);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-hessian/pom.xml.off b/sandbox/old/contrib/binding-hessian/pom.xml.off
new file mode 100644
index 0000000000..cd642e0c01
--- /dev/null
+++ b/sandbox/old/contrib/binding-hessian/pom.xml.off
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.hessian</groupId>
+ <artifactId>hessian</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+ <name>Tuscany Hessian Binding Extension </name>
+ <modules>
+ <module>binding</module>
+ </modules>
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>objectstyle</id>
+ <url>http://www.objectstyle.org/maven2/</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ <version>3.0.20</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <!-- junit version -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/binding-jms/DISCLAIMER b/sandbox/old/contrib/binding-jms/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/old/contrib/binding-jms/LICENSE b/sandbox/old/contrib/binding-jms/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/LICENSE
@@ -0,0 +1,205 @@
+
+ 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.
+
+
+
diff --git a/sandbox/old/contrib/binding-jms/NOTICE b/sandbox/old/contrib/binding-jms/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/binding-jms/pom.xml b/sandbox/old/contrib/binding-jms/pom.xml
new file mode 100644
index 0000000000..8073c62624
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>${version}</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <name>Apache Tuscany JMS Binding</name>
+
+ <dependencies>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java
new file mode 100644
index 0000000000..c96bb76b1b
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.io.Serializable;
+import java.io.StringReader;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+public class DefaultOperationAndDataBinding implements OperationAndDataBinding {
+
+ protected String operationPropertyName;
+
+ private boolean xmlFormat;
+
+ public DefaultOperationAndDataBinding(JMSBindingDefinition jmsBinding) {
+ this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName();
+ this.xmlFormat = jmsBinding.isXMLFormat();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#getOperationName(javax.jms.Message)
+ */
+ public String getOperationName(Message message) {
+ try {
+
+ return message.getStringProperty(operationPropertyName);
+
+ } catch (JMSException e) {
+ throw new JMSBindingException("Exception retreiving operation name from message", e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#setOperationName(javax.jms.Message,
+ * java.lang.String)
+ */
+ public void setOperationName(String operationName, Message message) {
+ try {
+
+ message.setStringProperty(operationPropertyName, operationName);
+
+ } catch (JMSException e) {
+ throw new JMSBindingException("Exception setting the operation name on message", e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Session,
+ * java.lang.Object)
+ */
+ public Message createJMSMessage(Session session, Object o) {
+ if (xmlFormat) {
+ return createXMLJMSMessage(session, o);
+ } else {
+ return createObjectJMSMessage(session, o);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Message)
+ */
+ public Object extractPayload(Message msg) {
+ if (xmlFormat) {
+ return extractXMLPayload(msg);
+ } else {
+ return extractObjectPayload(msg);
+ }
+ }
+
+ protected Object extractXMLPayload(Message msg) {
+ try {
+
+ String xml = ((TextMessage)msg).getText();
+
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
+ StAXOMBuilder builder = new StAXOMBuilder(reader);
+ OMElement omElement = builder.getDocumentElement();
+
+ return new Object[] {omElement};
+
+ } catch (XMLStreamException e) {
+ throw new JMSBindingException(e);
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Message createXMLJMSMessage(Session session, Object o) {
+ try {
+
+ TextMessage message = session.createTextMessage();
+
+ if (o instanceof OMElement) {
+ message.setText(o.toString());
+ } else {
+ message.setText(((Object[])o)[0].toString());
+ }
+
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Object extractObjectPayload(Message msg) {
+ try {
+
+ return ((ObjectMessage)msg).getObject();
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected Message createObjectJMSMessage(Session session, Object o) {
+ try {
+
+ ObjectMessage message = session.createObjectMessage(); // default
+ message.setObject((Serializable)o);
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
new file mode 100644
index 0000000000..6b38743b20
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
@@ -0,0 +1,177 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import javax.jms.Destination;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+
+/**
+ * Builds a Service or Reference for JMS binding.
+ *
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+
+public class JMSBindingBuilder extends BindingBuilderExtension<JMSBindingDefinition> {
+
+ private static final String DEFAULT_JMS_RESOURCE_FACTORY =
+ "org.apache.tuscany.binding.jms.SimpleJMSResourceFactory";
+
+ private static final String OM_DATA_BINDING = OMElement.class.getName();
+
+ protected Class<JMSBindingDefinition> getBindingType() {
+ return JMSBindingDefinition.class;
+ }
+
+ public ServiceBinding build(CompositeComponent parent,
+ BoundServiceDefinition serviceDefinition,
+ JMSBindingDefinition jmsBinding,
+ DeploymentContext deploymentContext) {
+
+ Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
+
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ jmsBinding.setXMLFormat(serviceContract instanceof WSDLServiceContract);
+
+ JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding);
+
+ if (serviceContract instanceof WSDLServiceContract) {
+ serviceContract.setDataBinding(OM_DATA_BINDING);
+ }
+
+ OperationAndDataBinding requestODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+ OperationAndDataBinding responseODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+
+ return new JMSServiceBinding(serviceDefinition.getName(), parent, jmsBinding, jmsResourceFactory,
+ serviceContract, requestODB, responseODB, interfaze);
+ }
+
+ public JMSReferenceBinding build(CompositeComponent parent,
+ BoundReferenceDefinition referenceDefinition,
+ JMSBindingDefinition jmsBinding,
+ DeploymentContext deploymentContext) {
+
+ String name = referenceDefinition.getName();
+ ServiceContract serviceContract;
+ try {
+ serviceContract = (ServiceContract) referenceDefinition.getServiceContract().clone();
+ } catch (CloneNotSupportedException e) {
+ throw new JMSBindingException("Couldn't clone the Service Contract", e);
+ }
+ serviceContract.setDataBinding(OM_DATA_BINDING);
+
+ JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding);
+
+ Destination requestDest;
+ Destination replyDest = null;
+ try {
+ requestDest = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
+ if (jmsBinding.getResponseDestinationName() != null) {
+ replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
+ }
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+
+ OperationAndDataBinding requestODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+ OperationAndDataBinding responseODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+
+ return new JMSReferenceBinding(name, parent, jmsBinding, jmsResourceFactory, serviceContract, requestODB, responseODB,
+ requestDest, replyDest);
+
+ }
+
+ private JMSResourceFactory getJMSResourceFactory(JMSBindingDefinition jmsBinding) {
+ String className = jmsBinding.getJmsResourceFactoryName();
+ if (className != null && !className.equals("")) {
+ try {
+ Class factoryClass = Class.forName(className != null ? className : DEFAULT_JMS_RESOURCE_FACTORY);
+ Constructor constructor = factoryClass.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class});
+ return (JMSResourceFactory) constructor.newInstance(jmsBinding);
+ } catch (ClassNotFoundException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (SecurityException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (NoSuchMethodException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (IllegalArgumentException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (InstantiationException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (IllegalAccessException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (InvocationTargetException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ }
+ } else {
+ return new SimpleJMSResourceFactory(jmsBinding);
+ }
+
+ }
+
+ protected OperationAndDataBinding getRequestOperationAndDatabinding(JMSBindingDefinition jmsBinding,
+ ClassLoader cl) {
+ String className = jmsBinding.getRequestOperationAndDatabindingName();
+ OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className);
+ return operationAndDataBinding;
+ }
+
+ protected OperationAndDataBinding getResponseOperationAndDatabinding(JMSBindingDefinition jmsBinding,
+ ClassLoader cl) {
+ String className = jmsBinding.getResponseOperationAndDatabindingName();
+ OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className);
+ return operationAndDataBinding;
+ }
+
+ protected OperationAndDataBinding instantiateClass(JMSBindingDefinition jmsBinding, ClassLoader cl,
+ String className) {
+ OperationAndDataBinding operationAndDataBinding;
+ if (cl == null) {
+ cl = this.getClass().getClassLoader();
+ }
+ try {
+ Class clazz;
+ try {
+ clazz = cl.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ clazz = this.getClass().getClassLoader().loadClass(className);
+ }
+ Constructor constructor = clazz.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class});
+ operationAndDataBinding = (OperationAndDataBinding) constructor.newInstance(jmsBinding);
+
+ } catch (Throwable e) {
+ throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
+ }
+ return operationAndDataBinding;
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java
new file mode 100644
index 0000000000..96f2599645
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * Represents a binding to a JMS resource.
+ */
+
+public class JMSBindingDefinition extends BindingDefinition {
+
+ public final static int DESTINATION_TYPE_QUEUE = 0;
+ public final static int DESTINATION_TYPE_TOPIC = 1;
+
+ private int destinationType = DESTINATION_TYPE_QUEUE;
+
+ private String destinationName;
+
+ // Topic or Query factory name
+ private String connectionFactoryName;
+
+ private String activationSpecName;
+
+ private String initialContextFactoryName; // "org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+
+ private String jNDIProviderURL; // "tcp://hostname:61616"
+
+ // Maps to javax.jms.DeliveryMode
+ private int deliveryMode = DeliveryMode.NON_PERSISTENT;
+
+ private int timeToLive = 1000; // in mili seconds
+
+ private int priority;
+
+ private String replyTo;
+
+ private String jmsResourceFactoryName;
+
+ private String operationSelectorName;
+
+ private String operationSelectorPropertyName = DEFAULT_OPERATION_PROP_NAME;
+
+ private String correlationScheme;
+ private String responseDestinationName;
+
+ private String requestOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME;
+ private String responseOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME;
+
+ private boolean xmlFormat;
+
+ public static final String DEFAULT_ODB_CLASSNAME = DefaultOperationAndDataBinding.class.getName();
+ public static final String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
+
+ public JMSBindingDefinition(int destinationType,
+ String destinationName,
+ String connectionFactoryName,
+ String activationSpecName,
+ String initialContextFactoryName,
+ String providerURL,
+ int deliveryMode,
+ int timeToLive,
+ int priority,
+ String replyTo) {
+ super();
+ this.destinationType = destinationType;
+ this.destinationName = destinationName;
+ this.connectionFactoryName = connectionFactoryName;
+ this.activationSpecName = activationSpecName;
+ this.initialContextFactoryName = initialContextFactoryName;
+ this.jNDIProviderURL = providerURL;
+ this.deliveryMode = deliveryMode;
+ this.timeToLive = timeToLive;
+ this.priority = priority;
+ this.replyTo = replyTo;
+ }
+
+ public JMSBindingDefinition() {
+ super();
+ }
+
+ public String getActivationSpecName() {
+ return activationSpecName;
+ }
+
+ public void setActivationSpecName(String activationSpecName) {
+ this.activationSpecName = activationSpecName;
+ }
+
+ public String getConnectionFactoryName() {
+ return connectionFactoryName;
+ }
+
+ public void setConnectionFactoryName(String connectionFactoryName) {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ public int getDeliveryMode() {
+ return deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode) {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public String getDestinationName() {
+ return destinationName;
+ }
+
+ public void setDestinationName(String destinationName) {
+ this.destinationName = destinationName;
+ }
+
+ public String getInitialContextFactoryName() {
+ return initialContextFactoryName;
+ }
+
+ public void setInitialContextFactoryName(String initialContextFactoryName) {
+ this.initialContextFactoryName = initialContextFactoryName;
+ }
+
+ public String getJNDIProviderURL() {
+ return jNDIProviderURL;
+ }
+
+ public void setJNDIProviderURL(String providerURL) {
+ jNDIProviderURL = providerURL;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+ public int getTimeToLive() {
+ return timeToLive;
+ }
+
+ public void setTimeToLive(int timeToLive) {
+ this.timeToLive = timeToLive;
+ }
+
+ public int getDestinationType() {
+ return destinationType;
+ }
+
+ public void setDestinationType(int destinationType) {
+ this.destinationType = destinationType;
+ }
+
+ public String getJmsResourceFactoryName() {
+ return jmsResourceFactoryName;
+ }
+
+ public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
+ this.jmsResourceFactoryName = jmsResourceFactoryName;
+ }
+
+ public String getOperationSelectorName() {
+ return operationSelectorName;
+ }
+
+ public void setOperationSelectorName(String operationSelectorName) {
+ this.operationSelectorName = operationSelectorName;
+ }
+
+ public String getOperationSelectorPropertyName() {
+ return operationSelectorPropertyName;
+ }
+
+ public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
+ this.operationSelectorPropertyName = operationSelectorPropertyName;
+ }
+
+ public void setCorrelationScheme(String correlationScheme) {
+ this.correlationScheme = correlationScheme;
+ }
+
+ public String getCorrelationScheme() {
+ return correlationScheme;
+ }
+
+ public void setCreateDestination(String create) {
+ }
+
+ public void setResponseDestinationName(String name) {
+ this.responseDestinationName = name;
+ }
+
+ public String getResponseDestinationName() {
+ return responseDestinationName;
+ }
+
+ public void setResponseDestinationType(int destination_type_queue2) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCreateResponseDestination(String create) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setRequestOperationAndDatabindingName(String name) {
+ this.requestOperationAndDatabindingName = name;
+ }
+
+ public String getRequestOperationAndDatabindingName() {
+ return requestOperationAndDatabindingName;
+ }
+
+ public void setResponseOperationAndDatabindingName(String name) {
+ this.responseOperationAndDatabindingName = name;
+ }
+
+ public String getResponseOperationAndDatabindingName() {
+ return responseOperationAndDatabindingName;
+ }
+
+ public boolean isXMLFormat() {
+ return xmlFormat;
+ }
+
+ public void setXMLFormat(boolean b) {
+ this.xmlFormat = b;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java
new file mode 100644
index 0000000000..a197eeffc6
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+public class JMSBindingException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public JMSBindingException() {
+ super();
+ }
+
+ public JMSBindingException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public JMSBindingException(String arg0) {
+ super(arg0);
+ }
+
+ public JMSBindingException(Throwable arg0) {
+ super(arg0);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java
new file mode 100644
index 0000000000..c20b5250f4
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java
@@ -0,0 +1,199 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.osoa.sca.annotations.Scope;
+
+/**
+ * Loader for handling <binding.jms> elements based on the 0.96 draft 1 spec.
+ */
+@Scope("COMPOSITE")
+public class JMSBindingLoader extends LoaderExtension<JMSBindingDefinition> {
+
+ public static final QName BINDING_JMS =
+ new QName(XML_NAMESPACE_1_0, "binding.jms");
+
+ public static final List<String> VALID_CORRELATION_SCHEMES =
+ Arrays.asList(new String[] {"requestmsgidtocorrelid", "requestcorrelidtocorrelid", "none"});
+
+ public JMSBindingLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return BINDING_JMS;
+ }
+
+ public JMSBindingDefinition load(CompositeComponent parent,
+ ModelObject modelObject,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+
+ JMSBindingDefinition jmsBinding = new JMSBindingDefinition();
+
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null && uri.length() > 0) {
+ parseURI(jmsBinding, uri);
+ }
+
+ String correlationScheme = reader.getAttributeValue(null, "correlationScheme");
+ if (correlationScheme != null && correlationScheme.length() > 0) {
+ if (VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
+ jmsBinding.setCorrelationScheme(correlationScheme);
+ } else {
+ throw new LoaderException("invalid correlationScheme: " + correlationScheme);
+ }
+ }
+
+ String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
+ if (initialContextFactory != null && initialContextFactory.length() > 0) {
+ jmsBinding.setInitialContextFactoryName(initialContextFactory);
+ }
+
+ String jndiProviderURL = reader.getAttributeValue(null, "JNDIProviderURL");
+ if (jndiProviderURL != null && jndiProviderURL.length() > 0) {
+ jmsBinding.setJNDIProviderURL(jndiProviderURL);
+ }
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String elementName = reader.getName().getLocalPart();
+ if ("destination".equals(elementName)) {
+ parseDestination(reader, jmsBinding);
+ } else if ("connectionFactory".equals(elementName)) {
+ parseConnectionFactory(reader, jmsBinding);
+ } else if ("activationSpec".equals(elementName)) {
+ parseActivationSpec(reader, jmsBinding);
+ } else if ("response".equals(elementName)) {
+ parseResponse(reader, jmsBinding);
+ } else if ("headers".equals(elementName)) {
+ parseHeaders(reader, jmsBinding);
+ } else if ("operationAndDataBinding".equals(elementName)) {
+ parseOperationAndDataBinding(reader, jmsBinding);
+ } else if ("operation".equals(elementName)) {
+ parseOperation(reader, jmsBinding);
+ } else if ("resourceAdapter".equals(elementName)) {
+ parseResourceAdapter(reader, jmsBinding);
+ }
+ reader.next();
+ break;
+
+ case END_ELEMENT:
+ QName x = reader.getName();
+ if (x.equals(BINDING_JMS)) {
+ return jmsBinding;
+ }
+ throw new RuntimeException("Incomplete binding.jms definition");
+ }
+ }
+ }
+
+ protected void parseActivationSpec(XMLStreamReader reader, JMSBindingDefinition jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setActivationSpecName(name);
+ } else {
+ throw new RuntimeException("missing ActivationSpec name");
+ }
+ }
+
+ protected void parseConnectionFactory(XMLStreamReader reader, JMSBindingDefinition jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setConnectionFactoryName(name);
+ } else {
+ throw new RuntimeException("missing connectionFactory name");
+ }
+ }
+
+ protected void parseResponse(XMLStreamReader reader, JMSBindingDefinition jmsBinding) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void parseResourceAdapter(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException {
+ // TODO Auto-generated method stub
+ }
+
+ protected void parseOperation(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException {
+ // TODO Auto-generated method stub
+ }
+
+ protected void parseOperationAndDataBinding(XMLStreamReader reader, JMSBindingDefinition jmsBinding)
+ throws XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ String use = reader.getAttributeValue(null, "use");
+ if (name != null && name.length() > 0) {
+ if ("request".equalsIgnoreCase(use)) {
+ jmsBinding.setRequestOperationAndDatabindingName(name);
+ } else if ("response".equalsIgnoreCase(use)) {
+ jmsBinding.setResponseOperationAndDatabindingName(name);
+ } else {
+ jmsBinding.setRequestOperationAndDatabindingName(name);
+ jmsBinding.setResponseOperationAndDatabindingName(name);
+ }
+ }
+ }
+
+ protected void parseHeaders(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException {
+ // TODO Auto-generated method stub
+ }
+
+ protected void parseDestination(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setDestinationName(name);
+ }
+ String type = reader.getAttributeValue(null, "type");
+ if (type != null && type.length() > 0) {
+ if ("queue".equalsIgnoreCase(type)) {
+ jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_QUEUE);
+ } else if ("topic".equalsIgnoreCase("type")) {
+ jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_TOPIC);
+ } else {
+ throw new RuntimeException("invalid destination type: " + type);
+ }
+ }
+ String create = reader.getAttributeValue(null, "create");
+ if (create != null && create.length() > 0) {
+ jmsBinding.setCreateDestination(create);
+ }
+ }
+
+ protected void parseURI(JMSBindingDefinition jmsBinding, String uri) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java
new file mode 100644
index 0000000000..56e367eca2
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.Method;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+public class JMSProxy implements MessageListener {
+
+ protected Method operationMethod;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+ protected InboundWire inboundWire;
+ protected String correlationScheme;
+
+ public JMSProxy(InboundWire inboundWire,
+ JMSResourceFactory jmsResourceFactory,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ String correlationScheme) throws NamingException {
+
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.inboundWire = inboundWire;
+ this.correlationScheme = correlationScheme;
+ }
+
+ public void onMessage(Message requestJMSMsg) {
+ try {
+ Object responsePayload = invokeService(requestJMSMsg);
+ sendReply(requestJMSMsg, responsePayload);
+ } catch (Exception e) {
+ sendFaultReply(requestJMSMsg, e);
+ }
+ }
+
+ protected Object invokeService(Message requestJMSMsg) throws JMSException {
+
+ String operationName = requestOperationAndDataBinding.getOperationName(requestJMSMsg);
+ Object requestPayload = requestOperationAndDataBinding.extractPayload(requestJMSMsg);
+
+ Operation op = (Operation)inboundWire.getServiceContract().getOperations().get(operationName);
+ InvocationChain chain = inboundWire.getInvocationChains().get(op);
+
+ org.apache.tuscany.spi.wire.Message tuscanyRequestMsg = new MessageImpl();
+ tuscanyRequestMsg.setTargetInvoker(chain.getTargetInvoker());
+ tuscanyRequestMsg.setBody(requestPayload);
+
+ org.apache.tuscany.spi.wire.Message tuscanyResponseMsg = null;
+
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor != null) {
+ tuscanyResponseMsg = headInterceptor.invoke(tuscanyRequestMsg);
+ }
+
+ // TODO: what if headInterceptor is null?
+
+ return tuscanyResponseMsg.getBody();
+ }
+
+ protected void sendReply(Message requestJMSMsg, Object responsePayload) {
+ try {
+
+ if (requestJMSMsg.getJMSReplyTo() == null) {
+ // assume no reply is expected
+ return;
+ }
+
+ Session session = jmsResourceFactory.createSession();
+ Message replyJMSMsg = responseOperationAndDataBinding.createJMSMessage(session, responsePayload);
+
+ replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
+ replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
+
+ if (correlationScheme == null || "RequestMsgIDToCorrelID".equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
+ } else if ("RequestCorrelIDToCorrelID".equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
+ }
+
+ Destination destination = requestJMSMsg.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(destination);
+
+ producer.send(replyJMSMsg);
+
+ producer.close();
+ session.close();
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected void sendFaultReply(Message requestJMSMsg, Exception e) {
+ sendReply(requestJMSMsg, new JMSBindingException("exception invoking JMS service", e));
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java
new file mode 100644
index 0000000000..3aa0bf31eb
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Destination;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+public class JMSReferenceBinding extends ReferenceBindingExtension {
+ private static final QName BINDING_JMS = new QName(XML_NAMESPACE_1_0, "binding.jms");
+
+ protected JMSBindingDefinition jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSReferenceBinding(String name,
+ CompositeComponent parent,
+ JMSBindingDefinition jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ ServiceContract<?> bindingServiceContract,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Destination requestDest,
+ Destination replyDest) {
+
+ super(name, parent);
+ this.bindingServiceContract = bindingServiceContract;
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.requestDest = requestDest;
+ this.replyDest = replyDest;
+ }
+
+ public QName getBindingType() {
+ return BINDING_JMS;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ return new JMSTargetInvoker(jmsResourceFactory, jmsBinding, operation.getName(),
+ requestOperationAndDataBinding, responseOperationAndDataBinding, requestDest,
+ replyDest);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java
new file mode 100644
index 0000000000..dbc43a6d34
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+public interface JMSResourceFactory {
+
+ public abstract Connection getConnection() throws NamingException, JMSException;
+
+ public abstract Session createSession() throws JMSException, NamingException;
+
+ public abstract void startConnection() throws JMSException, NamingException;
+
+ public abstract void closeConnection() throws JMSException, NamingException;
+
+ public abstract Destination lookupDestination(String jndiName) throws NamingException;
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java
new file mode 100644
index 0000000000..16cf6efe39
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+public class JMSServiceBinding extends ServiceBindingExtension {
+ private static final QName BINDING_JMS = new QName(XML_NAMESPACE_1_0, "binding.jms");
+
+ private JMSBindingDefinition jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private MessageConsumer consumer;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+
+ public JMSServiceBinding(String name,
+ CompositeComponent parent,
+ JMSBindingDefinition jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ ServiceContract<?> serviceBindingContract,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Class<?> service) {
+ super(name, parent);
+
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.bindingServiceContract = serviceBindingContract;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ }
+
+ public void start() {
+ super.start();
+ try {
+ registerListerner();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error starting JMSServiceBinding", e);
+ }
+ }
+
+ public void stop() {
+
+ try {
+ consumer.close();
+ jmsResourceFactory.closeConnection();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error stopping JMSServiceBinding", e);
+ }
+
+ super.stop();
+ }
+
+ private void registerListerner() throws NamingException, JMSException {
+
+ Session session = jmsResourceFactory.createSession();
+ Destination destination = session.createQueue(jmsBinding.getDestinationName());
+
+ consumer = session.createConsumer(destination);
+ consumer.setMessageListener(new JMSProxy(getInboundWire(), jmsResourceFactory, requestOperationAndDataBinding,
+ responseOperationAndDataBinding, jmsBinding.getCorrelationScheme()));
+
+ jmsResourceFactory.startConnection();
+
+ }
+
+ public QName getBindingType() {
+ return BINDING_JMS;
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java
new file mode 100644
index 0000000000..61e838c41a
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+
+/**
+ * Invoke a JMS reference.
+ */
+public class JMSTargetInvoker extends TargetInvokerExtension {
+
+ protected JMSBindingDefinition jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+
+ protected String operationName;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSTargetInvoker(JMSResourceFactory jmsResourceFactory,
+ JMSBindingDefinition jmsBinding,
+ String operationName,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Destination requestDest,
+ Destination replyDest) {
+ super(null, null, null);
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.operationName = operationName;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.requestDest = requestDest;
+ this.replyDest = replyDest;
+ }
+
+ public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ Session session = jmsResourceFactory.createSession();
+ try {
+
+ Destination replyToDest = (replyDest != null) ? replyDest : session.createTemporaryQueue();
+ Message requestMsg = sendRequest((Object[])payload, session, replyToDest);
+ Message replyMsg = receiveReply(session, replyToDest, requestMsg.getJMSMessageID());
+
+ return responseOperationAndDataBinding.extractPayload(replyMsg);
+
+ } finally {
+ session.close();
+ }
+ } catch (JMSException e) {
+ throw new InvocationTargetException(e);
+ } catch (NamingException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ protected Message sendRequest(Object[] payload, Session session, Destination replyToDest) throws JMSException {
+
+ Message requestMsg = requestOperationAndDataBinding.createJMSMessage(session, payload);
+
+ requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
+ requestMsg.setJMSPriority(jmsBinding.getPriority());
+
+ requestOperationAndDataBinding.setOperationName(operationName, requestMsg);
+ requestMsg.setJMSReplyTo(replyToDest);
+
+ MessageProducer producer = session.createProducer(requestDest);
+ try {
+ producer.send(requestMsg);
+ } finally {
+ producer.close();
+ }
+ return requestMsg;
+ }
+
+ protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException,
+ NamingException {
+ String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'";
+ MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
+ Message replyMsg;
+ try {
+ jmsResourceFactory.startConnection();
+ replyMsg = consumer.receive(jmsBinding.getTimeToLive());
+ } finally {
+ consumer.close();
+ }
+ return replyMsg;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java
new file mode 100644
index 0000000000..9867f7d97b
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ * Interface for a component that does operation selection and message payload
+ * databinding
+ */
+public interface OperationAndDataBinding {
+
+ /**
+ * Get the operation name from a JMS Message
+ */
+ public abstract String getOperationName(Message message);
+
+ /**
+ * Set the operation name on a JMS Message
+ */
+ public abstract void setOperationName(String operationName, Message message);
+
+ /**
+ * Extracts the payload from a JMS Message
+ */
+ public abstract Object extractPayload(Message msg);
+
+ /**
+ * Create a JMS Message containing the payload
+ */
+ public abstract Message createJMSMessage(Session session, Object payload);
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java
new file mode 100644
index 0000000000..86cdfa272e
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SimpleJMSResourceFactory implements JMSResourceFactory {
+
+ private JMSBindingDefinition jmsBinding;
+ private Connection con;
+ private Context context;
+ private boolean isConnectionStarted;
+
+ public SimpleJMSResourceFactory(JMSBindingDefinition jmsBinding) {
+ this.jmsBinding = jmsBinding;
+ }
+
+ /*
+ * This is a simple implementation where a connection is created per binding
+ * Ideally the resource factory should be able to leverage the host
+ * environment to provide connection pooling if it can. For ex If Tuscany is
+ * running inside an AppServer Then we could leverage the JMS resources it
+ * provides
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
+ */
+ public Connection getConnection() throws NamingException, JMSException {
+ if (con == null) {
+ createConnection();
+ }
+ return con;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
+ */
+ public Session createSession() throws JMSException, NamingException {
+ return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection()
+ */
+ public void startConnection() throws JMSException, NamingException {
+ if (!isConnectionStarted) {
+ getConnection().start();
+ isConnectionStarted = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection()
+ */
+ public void closeConnection() throws JMSException, NamingException {
+ if (con != null) {
+ con.close();
+ }
+ }
+
+ private void createConnection() throws NamingException, JMSException {
+ if (context == null) {
+ createInitialContext();
+ }
+ ConnectionFactory conFac = (ConnectionFactory)context.lookup(jmsBinding.getConnectionFactoryName());
+ con = conFac.createConnection();
+ }
+
+ private void createInitialContext() throws NamingException {
+ Properties props = new Properties();
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY, jmsBinding.getInitialContextFactoryName().trim());
+ props.setProperty(Context.PROVIDER_URL, jmsBinding.getJNDIProviderURL().trim());
+
+ context = new InitialContext(props);
+ }
+
+ public Destination lookupDestination(String jndiName) throws NamingException {
+ if (context == null) {
+ createInitialContext();
+ }
+ return (Destination)context.lookup(jndiName);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java
new file mode 100644
index 0000000000..eb6e068462
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.databinding.Mediator;
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the
+ * other one
+ */
+public abstract class AbstractJmsTransformer<T> extends TransformerExtension<T, T> implements PullTransformer<T, T> {
+
+ protected static final String IDL_INPUT = "idl:input";
+ protected static final String JMS_INPUT = "jms:input";
+ protected static final String IDL_OUTPUT = "idl:output";
+ protected static final String JMS_OUTPUT = "jms:output";
+
+ protected DataBindingRegistry dataBindingRegistry;
+
+ protected Mediator mediator;
+
+ public AbstractJmsTransformer() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10;
+ }
+
+ protected Object read(byte[] bytes) {
+ try {
+ ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bis) {
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ try {
+ return Class.forName(desc.getName(), false, this.getClass().getClassLoader());
+ } catch (ClassNotFoundException e) {
+ return super.resolveClass(desc);
+ }
+ }
+
+ };
+ Object object = ois.readObject();
+ ois.close();
+ bis.close();
+
+ return object;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ protected byte[] write(Object source) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(source);
+ oos.close();
+ bos.close();
+ return bos.toByteArray();
+ } catch (IOException e) {
+ throw new TransformationException(e);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java
new file mode 100644
index 0000000000..30add8e082
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the
+ * other one
+ */
+@Service(Transformer.class)
+public class Input2JmsInputTransformer extends AbstractJmsTransformer<Object[]> {
+
+ public Input2JmsInputTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return IDL_INPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JMS_INPUT;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object[].class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ return new Object[] {write(source)};
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java
new file mode 100644
index 0000000000..65f84d1383
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the
+ * other one
+ */
+@Service(Transformer.class)
+public class JmsInput2InputTransformer extends AbstractJmsTransformer<Object[]> {
+
+ public JmsInput2InputTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JMS_INPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return IDL_INPUT;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object[].class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ return (Object[])read((byte[])source[0]);
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java
new file mode 100644
index 0000000000..1696609743
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+@Service(Transformer.class)
+public class JmsOutput2OutputTransformer extends AbstractJmsTransformer<Object> {
+
+ /**
+ * @param wrapperHandler
+ */
+ public JmsOutput2OutputTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JMS_OUTPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return IDL_OUTPUT;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object response, TransformationContext context) {
+ return read((byte[])response);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java
new file mode 100644
index 0000000000..5a82f912c5
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+@Service(Transformer.class)
+public class Output2JmsOutputTransformer extends AbstractJmsTransformer<Object> {
+ /**
+ * @param wrapperHandler
+ */
+ public Output2JmsOutputTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return IDL_OUTPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JMS_OUTPUT;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object response, TransformationContext context) {
+ return write(response);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..0c99331b4f
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,52 @@
+<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms.JMSBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl
new file mode 100644
index 0000000000..9f01162f5d
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl
@@ -0,0 +1,52 @@
+<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms.JMSBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java
new file mode 100644
index 0000000000..24472afa53
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface GreetingService {
+ String greet(String name);
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java
new file mode 100644
index 0000000000..abf7ecef88
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+public class GreetingServiceImpl implements GreetingService {
+
+ public String greet(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java
new file mode 100644
index 0000000000..21c40bd6b6
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloworldService {
+ String getGreetings(String name);
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java
new file mode 100644
index 0000000000..8119bde323
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+public class HelloworldServiceImpl implements HelloworldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroService.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroService.java
new file mode 100644
index 0000000000..0b5acb44cc
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+public interface IntroService {
+ public String greet(String name);
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java
new file mode 100644
index 0000000000..6222f368ad
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+
+public class IntroServiceImpl implements IntroService {
+
+ private GreetingService extService;
+
+ @Reference
+ public void setExtService(GreetingService extService) {
+ this.extService = extService;
+ }
+
+ public String greet(String name) {
+ return extService.greet(name);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java
new file mode 100644
index 0000000000..d2bf4bfcda
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+public class JMSBindingLoaderTestCase extends TestCase {
+
+ private JMSBindingLoader loader;
+
+ public void testMinimal() throws LoaderException, XMLStreamException {
+ String xml = "<binding.jms></binding.jms>";
+ XMLStreamReader reader = createReader(xml);
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertNotNull(jmsBinding);
+ }
+
+ public void testCorrelationScheme() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader =
+ createReader("<binding.jms correlationScheme=\"RequestMsgIDToCorrelID\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("RequestMsgIDToCorrelID", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"RequestCorrelIDToCorrelID\"></binding.jms>");
+ jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("RequestCorrelIDToCorrelID", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"none\"></binding.jms>");
+ jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("none", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"xxx\"></binding.jms>");
+ try {
+ jmsBinding = loader.load(null, null, reader, null);
+ fail("expecting invalid correlationScheme");
+ } catch (LoaderException e) {
+ // expected
+ }
+ }
+
+ public void testDestination() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms><destination name=\"foo\"/></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("foo", jmsBinding.getDestinationName());
+ }
+
+ public void testInitialContextFactory() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms initialContextFactory=\"myicf\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myicf", jmsBinding.getInitialContextFactoryName());
+ }
+
+ public void testJNDIProviderURL() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms JNDIProviderURL=\"myURL\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myURL", jmsBinding.getJNDIProviderURL());
+ }
+
+ public void testConnectionFactory() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms> <connectionFactory name=\"myfactory\"/> </binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myfactory", jmsBinding.getConnectionFactoryName());
+ }
+
+ public void testActivationSpec() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms> <activationSpec name=\"myas\"/></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myas", jmsBinding.getActivationSpecName());
+ }
+
+ private XMLStreamReader createReader(String xml) throws XMLStreamException {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ String xxx = "<xxx xmlns=\"" + XML_NAMESPACE_1_0 + "\">" + xml + "</xxx>";
+ XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xxx));
+ reader.nextTag();
+ reader.nextTag();
+ return reader;
+ }
+
+ protected void setUp() throws Exception {
+ this.loader = new JMSBindingLoader(null);
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java
new file mode 100644
index 0000000000..115c88f8b7
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.naming.NamingException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.activemq.broker.BrokerContainer;
+import org.activemq.broker.impl.BrokerContainerImpl;
+import org.activemq.store.vm.VMPersistenceAdapter;
+import org.apache.tuscany.test.SCATestCase;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.xml.sax.SAXException;
+
+public class JMSBindingTestCaseX extends SCATestCase {
+
+ private IntroService introService;
+ private BrokerContainer broker;
+
+ protected static final String REQUEST_XML =
+ "<ns:getGreetings xmlns:ns=\"http://helloworld\"><ns:name>petra</ns:name></ns:getGreetings>";
+ protected static final String REPLY_XML =
+ "<ns1:getGreetingsResponse xmlns:ns1=\"http://helloworld\"><ns1:getGreetingsReturn>Hello petra</ns1:getGreetingsReturn></ns1:getGreetingsResponse>";
+
+ public void testJMSBinding() throws InvocationTargetException, SAXException, IOException,
+ ParserConfigurationException, NamingException, JMSException {
+ String reply = introService.greet("Rajith");
+ assertEquals("Hello Rajith", reply);
+
+ // TODO: the rest should be in a seperate test method but that doesn't
+ // work as you get broker conflicts
+ JMSTargetInvoker invoker = createJMSInvoker();
+ Object[] response = (Object[])invoker.invokeTarget(new Object[] {REQUEST_XML}, (short)0);
+
+ Diff diff = XMLUnit.compareXML(REPLY_XML, response[0].toString());
+ assertTrue(diff.toString(), diff.similar());
+
+ }
+
+ private JMSTargetInvoker createJMSInvoker() throws NamingException, JMSException {
+ JMSBindingDefinition binding = new JMSBindingDefinition();
+ binding.setInitialContextFactoryName("org.activemq.jndi.ActiveMQInitialContextFactory");
+ binding.setConnectionFactoryName("ConnectionFactory");
+ binding.setJNDIProviderURL("tcp://localhost:61616");
+ binding.setDestinationName("dynamicQueues/HelloworldServiceQueue");
+ binding.setTimeToLive(3000);
+ binding.setXMLFormat(true);
+ JMSResourceFactory rf = new SimpleJMSResourceFactory(binding);
+ Destination requestDest = rf.lookupDestination(binding.getDestinationName());
+ DefaultOperationAndDataBinding odb = new DefaultOperationAndDataBinding(binding);
+ JMSTargetInvoker invoker = new JMSTargetInvoker(rf, binding, "getGreetings", odb, odb, requestDest, null);
+ return invoker;
+ }
+
+ protected void setUp() throws Exception {
+ startBroker();
+ setApplicationSCDL(IntroService.class, "META-INF/sca/default.scdl");
+ addExtension("jms.binding", getClass().getClassLoader().getResource("META-INF/sca/jms.system.scdl"));
+ addExtension("idl.wsdl", getClass().getClassLoader().getResource("META-INF/sca/idl.wsdl.scdl"));
+ addExtension("databinding.axiom", getClass().getResource("/META-INF/sca/databinding.axiom.scdl"));
+ super.setUp();
+ CompositeContext context = CurrentCompositeContext.getContext();
+ introService = context.locateService(IntroService.class, "IntroServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ broker.stop();
+ }
+
+ public static void main(String[] args) {
+ JMSBindingTestCaseX test = new JMSBindingTestCaseX();
+ try {
+ test.setUp();
+ test.testJMSBinding();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void startBroker() throws Exception {
+ broker = new BrokerContainerImpl("JMS BindingDefinition Test");
+ // configure the broker
+ broker.addConnector("tcp://localhost:61616");
+ broker.setPersistenceAdapter(new VMPersistenceAdapter());
+ broker.start();
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java
new file mode 100644
index 0000000000..63a82ab6da
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+
+public class JMSProxyTestCase extends TestCase {
+
+ /**
+ * Tests the jms response msg has correlation id set to the request msg id
+ */
+ public void testOnMessageRequestMsgIDToCorrelID() throws NamingException, JMSException {
+
+ String id = "123";
+
+ MessageProducer producer = EasyMock.createNiceMock(MessageProducer.class);
+
+ Session session = EasyMock.createNiceMock(Session.class);
+ EasyMock.expect(session.createProducer(EasyMock.isA(Destination.class))).andReturn(producer);
+ EasyMock.replay(session);
+
+ ObjectMessage responseJMSMsg = EasyMock.createMock(ObjectMessage.class);
+ responseJMSMsg.setJMSDeliveryMode(1);
+ responseJMSMsg.setJMSPriority(1);
+ responseJMSMsg.setJMSCorrelationID(id);
+ EasyMock.replay(responseJMSMsg);
+
+ JMSResourceFactory jmsResourceFactory = EasyMock.createMock(JMSResourceFactory.class);
+ EasyMock.expect(jmsResourceFactory.createSession()).andReturn(session);
+
+ OperationAndDataBinding odb = EasyMock.createMock(OperationAndDataBinding.class);
+ EasyMock.expect(odb.createJMSMessage(EasyMock.eq(session), EasyMock.isA(Exception.class)))
+ .andReturn(responseJMSMsg);
+ EasyMock.replay(odb);
+
+ JMSProxy jmsProxy = new JMSProxy(null, jmsResourceFactory, null, odb, null);
+
+ Message requestJMSMsg = EasyMock.createMock(Message.class);
+ EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(new Destination() {
+ });
+
+ EasyMock.expect(requestJMSMsg.getJMSDeliveryMode()).andReturn(1);
+ EasyMock.expect(requestJMSMsg.getJMSPriority()).andReturn(1);
+
+ EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(new Destination() {
+ });
+ EasyMock.expect(requestJMSMsg.getJMSMessageID()).andReturn(id);
+
+ producer.send(EasyMock.isA(Message.class));
+ EasyMock.replay(producer);
+
+ EasyMock.replay(requestJMSMsg);
+ EasyMock.replay(jmsResourceFactory);
+
+ jmsProxy.onMessage(requestJMSMsg);
+
+ EasyMock.verify(requestJMSMsg);
+ EasyMock.verify(jmsResourceFactory);
+ EasyMock.verify(producer);
+ EasyMock.verify(session);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java
new file mode 100644
index 0000000000..7c9420b7f9
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.binding.jms.databinding;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for transformers
+ */
+public class JmsTransformerTestCase extends TestCase {
+ private Input2JmsInputTransformer t1;
+ private JmsInput2InputTransformer t2;
+ private Output2JmsOutputTransformer t3;
+ private JmsOutput2OutputTransformer t4;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ t1 = new Input2JmsInputTransformer();
+ t2 = new JmsInput2InputTransformer();
+ t3 = new Output2JmsOutputTransformer();
+ t4 = new JmsOutput2OutputTransformer();
+ }
+
+ public void testInput() {
+ Object[] args1 = new Object[] {1, "ABC", 1.0d};
+ Object[] args2 = t1.transform(args1, null);
+ assertEquals(1, args2.length);
+ assertTrue(args2[0] instanceof byte[]);
+ Object[] args3 = t2.transform(args2, null);
+ for (int i = 0; i < args3.length; i++) {
+ assertEquals(args1[i], args3[i]);
+ }
+
+ }
+
+ public void testOutput() {
+ Object args1 = "ABC";
+ Object args2 = t3.transform(args1, null);
+ assertTrue(args2 instanceof byte[]);
+ Object args3 = t4.transform(args2, null);
+ assertEquals(args1, args3);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/test/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-jms/src/test/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..7291363978
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/resources/META-INF/sca/default.scdl
@@ -0,0 +1,61 @@
+ <!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="jms.sample">
+
+ <service name="GreetingJMSService">
+ <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="greetingServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ <reference>GretingServiceComponent</reference>
+ </service>
+
+ <component name="GretingServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.GreetingServiceImpl"/>
+ </component>
+
+ <component name="IntroServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.IntroServiceImpl"/>
+ <reference name="extService" target="GreetingJMSReference">GreetingJMSReference</reference>
+ </component>
+
+ <reference name="GreetingJMSReference">
+ <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="dynamicQueues/greetingServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ </reference>
+
+ <service name="HelloworldJMSService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="HelloworldServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ <reference>HelloworldComponent</reference>
+ </service>
+
+ <component name="HelloworldComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.HelloworldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/sandbox/old/contrib/binding-jms/src/test/resources/wsdl/helloworld.wsdl b/sandbox/old/contrib/binding-jms/src/test/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..f1a62d8570
--- /dev/null
+++ b/sandbox/old/contrib/binding-jms/src/test/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsCallback">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsCallback">
+ <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="HelloWorldCallback">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-async-1.0-incubator-SNAPSHOT/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/binding-osgi/.pmd b/sandbox/old/contrib/binding-osgi/.pmd
new file mode 100644
index 0000000000..138693a60b
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/.pmd
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sandbox/old/contrib/binding-osgi/.ruleset b/sandbox/old/contrib/binding-osgi/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/binding-osgi/LICENSE.txt b/sandbox/old/contrib/binding-osgi/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/binding-osgi/NOTICE.txt b/sandbox/old/contrib/binding-osgi/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/binding-osgi/README.txt b/sandbox/old/contrib/binding-osgi/README.txt
new file mode 100755
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sandbox/old/contrib/binding-osgi/pom.xml.off b/sandbox/old/contrib/binding-osgi/pom.xml.off
new file mode 100644
index 0000000000..66f4e0d29a
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/pom.xml.off
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-osgi</artifactId>
+ <packaging>osgi-bundle</packaging>
+ <name>Apache Tuscany OSGi Runtime</name>
+ <description>Integration code to embed the Tuscany runtime in an OSGi container and a binding implementation for
+ consuming OSGi services and publishing SCA services to OSGi.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>core</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${sca.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix.plugins</groupId>
+ <artifactId>maven-osgi-plugin</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <ignorePackage>com.sun.msv.grammar, com.sun.msv.grammar.trex, com.sun.msv.reader,
+ com.sun.msv.reader.trex.ng, com.sun.msv.reader.util, com.sun.msv.util, com.sun.msv.verifier,
+ com.sun.msv.verifier.regexp, javax.resource.spi.work
+ </ignorePackage>
+ <osgiManifest>
+ <bundleName>${pom.name}</bundleName>
+ <bundleDescription>${pom.description}</bundleDescription>
+ <bundleVendor>${pom.organization.name}</bundleVendor>
+ <bundleLocalization>plugin</bundleLocalization>
+ <bundleSymbolicName>org.apache.tuscany</bundleSymbolicName>
+ <bundleActivator>org.apache.tuscany.osgi.LauncherActivator</bundleActivator>
+ <!--<exportPackage>org.apache.tuscany.*</exportPackage>-->
+ </osgiManifest>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/LauncherActivator.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/LauncherActivator.java
new file mode 100755
index 0000000000..2d7027e208
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/LauncherActivator.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.osgi;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.core.launcher.LauncherImpl;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.apache.tuscany.osgi.util.BundleContextUtil;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Responsible for launching the Tuscany Runtime in as part of an OSGi bundle
+ */
+public class LauncherActivator implements BundleActivator {
+
+ private LauncherImpl launcher;
+
+ public void start(BundleContext context) throws Exception {
+ BundleContextUtil.setContext(context);
+ startRuntime(context);
+
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ if (launcher != null) {
+ launcher.shutdownRuntime();
+ }
+ }
+
+
+ private void startRuntime(BundleContext context) throws OSGILauncherInitException {
+ launcher = new LauncherImpl();
+ // Current thread context classloader should be the webapp classloader
+ ClassLoader webappClassLoader = Thread.currentThread().getContextClassLoader();
+ launcher.setApplicationLoader(webappClassLoader);
+
+ try {
+ System.out.println(":::" + new File(".").toURL().toString());
+ // URL systemScdl = getSystemSCDL(systemScdlPath);
+ CompositeComponent rt =
+ launcher.bootRuntime(new File("./sca/system.scdl").toURI().toURL(), new NullMonitorFactory());
+ } catch (Exception e) {
+ throw new OSGILauncherInitException(e);
+ }
+ }
+
+ private void bootApplication(String name, URL scdl) throws TuscanyException {
+ CompositeComponent root = launcher.bootApplication(name, scdl);
+ root.start();
+ }
+
+ private void loadExtension(String name, URL scdl) throws TuscanyException {
+ CompositeComponent root = launcher.bootApplication(name, scdl);
+ root.start();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGILauncherInitException.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGILauncherInitException.java
new file mode 100644
index 0000000000..9951183aea
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGILauncherInitException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.osgi;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OSGILauncherInitException extends TuscanyException {
+
+ public OSGILauncherInitException(Throwable throwable) {
+ super(throwable);
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGiHost.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGiHost.java
new file mode 100644
index 0000000000..c16d27a937
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/OSGiHost.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.osgi;
+
+import java.util.Properties;
+
+import org.apache.tuscany.spi.host.ServletHost;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface OSGiHost extends ServletHost {
+
+ void registerService(String serviceName, Object service, Properties properties);
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteMethodException.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteMethodException.java
new file mode 100755
index 0000000000..0f59da4709
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteMethodException.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+public class NoRemoteMethodException extends OSGiBindingException {
+
+ private static final long serialVersionUID = 5037327699117168707L;
+
+ public NoRemoteMethodException(String message) {
+ super(message);
+ }
+
+ public NoRemoteMethodException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoRemoteMethodException(Throwable cause) {
+ super("", cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteServiceException.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteServiceException.java
new file mode 100755
index 0000000000..a370cb28c6
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/NoRemoteServiceException.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import org.osgi.framework.BundleException;
+
+/**
+ * FIXME class not used
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoRemoteServiceException extends BundleException {
+
+ public NoRemoteServiceException(String message) {
+ super(message);
+ }
+
+ public NoRemoteServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoRemoteServiceException(Throwable cause) {
+ super("", cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingBuilder.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingBuilder.java
new file mode 100755
index 0000000000..0967abf210
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingBuilder.java
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import org.osoa.sca.annotations.Constructor;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+
+import org.apache.tuscany.osgi.OSGiHost;
+
+/**
+ * Builds a Service or Reference for an OSGi binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiBindingBuilder extends BindingBuilderExtension<OSGiBindingDefinition> {
+
+ OSGiHost host;
+
+ @Constructor
+ public OSGiBindingBuilder(@Autowire OSGiHost host) {
+ this.host = host;
+ }
+
+ protected Class<OSGiBindingDefinition> getBindingType() {
+ return OSGiBindingDefinition.class;
+ }
+
+ public ServiceBinding build(CompositeComponent parent,
+ BoundServiceDefinition boundServiceDefinition,
+ OSGiBindingDefinition bindingDefinition,
+ DeploymentContext deploymentContext) {
+ String name = boundServiceDefinition.getName();
+ String osgiServiceName = bindingDefinition.getService();
+ return new OSGiServiceBinding(name, parent, wireService, osgiServiceName, host);
+ }
+
+ public OSGiReferenceBinding build(CompositeComponent parent,
+ BoundReferenceDefinition boundReferenceDefinition,
+ OSGiBindingDefinition bindingDefinition, DeploymentContext deploymentContext) {
+ String name = boundReferenceDefinition.getName();
+ return new OSGiReferenceBinding(name, parent);
+ }
+
+ protected Class<? extends Object> getServiceInterface(BoundServiceDefinition boundServiceDefinition) {
+ return boundServiceDefinition.getServiceContract().getInterfaceClass();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingDefinition.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingDefinition.java
new file mode 100755
index 0000000000..15cacff25d
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingDefinition.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * Represents a binding to an OSGi service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiBindingDefinition extends BindingDefinition {
+ private String uri;
+ private String service;
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public String getService() {
+ return service;
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingException.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingException.java
new file mode 100755
index 0000000000..288d4940f0
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingException.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class OSGiBindingException extends TuscanyRuntimeException {
+ protected OSGiBindingException() {
+ }
+
+ protected OSGiBindingException(String message) {
+ super(message);
+ }
+
+ protected OSGiBindingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected OSGiBindingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingLoader.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingLoader.java
new file mode 100755
index 0000000000..80465feabb
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingLoader.java
@@ -0,0 +1,66 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.model.ModelObject;
+
+/**
+ * Loader for handling <code>binding.osgi</code> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class OSGiBindingLoader extends LoaderExtension<OSGiBindingDefinition> {
+ public static final QName BINDING_OSGI = new QName("http://tuscany.apache.org/xmlns/osgi/1.0", "binding.osgi");
+
+ @Constructor
+ public OSGiBindingLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return BINDING_OSGI;
+ }
+
+ public OSGiBindingDefinition load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ String uri = reader.getAttributeValue(null, "uri");
+ String service = reader.getAttributeValue(null, "service");
+ LoaderUtil.skipToEndElement(reader);
+
+ OSGiBindingDefinition binding = new OSGiBindingDefinition();
+ binding.setURI(uri);
+ binding.setService(service);
+ return binding;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiInvoker.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiInvoker.java
new file mode 100755
index 0000000000..bb48a8b1e1
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiInvoker.java
@@ -0,0 +1,79 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Invokes the target service of an OSGi reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiInvoker implements TargetInvoker {
+ private final Method remoteMethod;
+ private final Object proxy;
+
+ OSGiInvoker(Object proxy, Method remoteMethod) {
+ assert remoteMethod.isAccessible();
+ this.remoteMethod = remoteMethod;
+ this.proxy = proxy;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ return remoteMethod.invoke(proxy, (Object[]) payload);
+ } catch (IllegalAccessException e) {
+ // the method we are passed must be accessible
+ throw new AssertionError(e);
+ }
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ // FIXME I think we can always have this cacheable as OSGi serviceBindings are thread-safe
+ public void setCacheable(boolean cacheable) {
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java
new file mode 100755
index 0000000000..4523d7e001
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.idl.java.JavaIDLUtils;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OSGiReferenceBinding extends ReferenceBindingExtension {
+ private static final QName BINDING_OSGI = new QName("http://tuscany.apache.org/xmlns/osgi/1.0", "binding.osgi");
+ //private final String uri;
+
+ public OSGiReferenceBinding(String name, CompositeComponent parent) {
+ super(name, parent);
+ //this.uri = uri;
+ }
+
+ public QName getBindingType() {
+ return BINDING_OSGI;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ try {
+ Object proxy = getProxy();
+ String name = operation.getName();
+ Method method = JavaIDLUtils.findMethod(operation, contract.getInterfaceClass().getMethods());
+ Class<?>[] parameterTypes = method.getParameterTypes();
+ Method remoteMethod = proxy.getClass().getMethod(name, parameterTypes);
+ return new OSGiInvoker(proxy, remoteMethod);
+ } catch (NoSuchMethodException e) {
+ // FIXME we should probably have this as a checked exception, which will entail adding to the SPI signature
+ throw new NoRemoteMethodException(operation.toString(), e);
+ }
+ }
+
+ protected Remote getProxy() {
+ //FIXME use service reference
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java
new file mode 100755
index 0000000000..57cae13779
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java
@@ -0,0 +1,116 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.osgi.binding;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObjectStartException;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.osgi.OSGiHost;
+import org.osgi.framework.ServiceFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OSGiServiceBinding extends ServiceBindingExtension {
+ private static final QName BINDING_OSGI = new QName("http://tuscany.apache.org/xmlns/osgi/1.0", "binding.osgi");
+ private final String osgiServiceName;
+ //private final Class<? extends Object> service;
+ private OSGiHost host;
+ private WireService wireService;
+
+ /**
+ * Creates a new service instance
+ *
+ * @param name the name of the SCA service
+ * @param parent the containing composite
+ * @param wireService the wire service to use for creating proxies
+ * @param osgiServiceName the name to publish the service as to the OSGi hose
+ * @param host the OSGi host
+ */
+ public OSGiServiceBinding(String name,
+ CompositeComponent parent,
+ WireService wireService,
+ String osgiServiceName,
+ OSGiHost host) {
+ super(name, parent);
+ this.osgiServiceName = osgiServiceName;
+ //this.service = service;
+ this.wireService = wireService;
+ this.host = host;
+ }
+
+ public void start() throws SCAObjectStartException {
+ super.start();
+ Properties properties = new Properties();
+ Object instance;
+ Class<?> clazz = inboundWire.getServiceContract().getInterfaceClass();
+ instance = wireService.createProxy(clazz, inboundWire);
+ if (instance instanceof ServiceFactory) {
+ host.registerService(osgiServiceName, instance, properties);
+ } else {
+ ServiceFactoryProxyHandler factoryProxy = new ServiceFactoryProxyHandler(instance);
+ Class<?> interfaces[] = instance.getClass().getInterfaces();
+ Class<?> proxyInterfaces[] = new Class<?>[interfaces.length + 1];
+ int i;
+ for (i = 0; i < interfaces.length; i++) {
+ proxyInterfaces[i] = interfaces[i];
+ }
+ proxyInterfaces[i] = ServiceFactory.class;
+ ClassLoader classLoader = instance.getClass().getClassLoader();
+ // TODO It seems we need a mixin capability for the service. We could add that to WireService
+ Object targetProxy = Proxy.newProxyInstance(classLoader, proxyInterfaces, factoryProxy);
+ host.registerService(osgiServiceName, targetProxy, properties);
+ }
+ //Register the service with OSGi
+ }
+
+ public void stop() {
+ super.stop();
+ //Unregister the service with OSGi
+ }
+
+ public QName getBindingType() {
+ return BINDING_OSGI;
+ }
+
+ private class ServiceFactoryProxyHandler implements InvocationHandler {
+
+ private Object instance;
+
+ public ServiceFactoryProxyHandler(Object instance) {
+ this.instance = instance;
+ }
+
+ public Object invoke(Object object, Method method, Object[] parms) throws Throwable {
+ if (method.getName().equals("getService")) {
+ return instance;
+ } else if (method.getName().equals("ungetService")) {
+ return null;
+ }
+ return method.invoke(instance, parms);
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/BundleContextUtil.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/BundleContextUtil.java
new file mode 100755
index 0000000000..02549a59fd
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/BundleContextUtil.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.osgi.util;
+
+import java.util.Dictionary;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+public final class BundleContextUtil {
+
+ private static BundleContext context;
+ private static final ServiceReference EMPTY_REFERENCE_ARRAY[] = {};
+
+ private BundleContextUtil() {
+ }
+
+ public static void setContext(BundleContext ctx) {
+ context = ctx;
+ }
+
+ public static ServiceReference[] getServiceReference(String clazz, String filter) throws InvalidSyntaxException {
+ ServiceReference[] references;
+ references = context.getServiceReferences(clazz, filter);
+ if (references == null) {
+ references = EMPTY_REFERENCE_ARRAY;
+ }
+ return references;
+ }
+
+ public static Object getService(ServiceReference reference) {
+ return context.getService(reference);
+ }
+
+ public static Object getService(ServiceReference references[]) {
+ if (references == null) {
+ return null;
+ }
+ return context.getService(references[0]);
+ }
+
+ public static void addServiceListener(ServiceListener listener, String filter) {
+ try {
+ if (filter != null) {
+ context.addServiceListener(listener, filter);
+ } else {
+ context.addServiceListener(listener);
+ }
+ } catch (InvalidSyntaxException e) {
+ //FIXME
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public static void removeServiceListener(ServiceListener listener) {
+ context.removeServiceListener(listener);
+ }
+
+ public static ServiceRegistration registerService(String serviceName,
+ Object serviceFactory,
+ Dictionary properties) {
+ return context.registerService(serviceName, serviceFactory, properties);
+ }
+
+ public static boolean trackServiceReference(String filter, ServiceListener listener) {
+ try {
+ context.addServiceListener(listener, filter);
+ return true;
+ } catch (InvalidSyntaxException e) {
+ return false;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/ClassloaderHook.java b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/ClassloaderHook.java
new file mode 100644
index 0000000000..33f7706c3e
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/java/org/apache/tuscany/osgi/util/ClassloaderHook.java
@@ -0,0 +1,64 @@
+package org.apache.tuscany.osgi.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.osgi.framework.Bundle;
+
+public class ClassloaderHook {
+
+ /**
+ * Return the BundleContext Classloader for the specified bundle.
+ *
+ * @param bundle The bundle whose BundleContext is desired.
+ * @return The BundleContext classloader for the specified bundle.
+ */
+ ClassLoader getClassLoader(final Bundle bundle) {
+ if (System.getSecurityManager() == null) {
+ Object bundleLoader = invokeMethod(bundle, "checkLoader", null, null);
+ return (ClassLoader) invokeMethod(bundleLoader, "createClassLoader", null, null);
+ }
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ Object bundleLoader = invokeMethod(bundle, "checkLoader", null, null);
+ return (ClassLoader) invokeMethod(bundleLoader, "createClassLoader", null, null);
+ }
+ });
+ }
+
+ /**
+ * Throws an IllegalStateException if the reflection logic cannot find what it is looking for. This probably means
+ * this class does not properly recognize the framework implementation.
+ *
+ * @param e Exception which indicates the reflection logic is confused.
+ */
+ protected void reflectionException(Exception e) {
+ throw new IllegalStateException(
+ "ClassLoaderHook does not recognize the framework implementation: " + e.getMessage());
+ }
+
+ private Object invokeMethod(Object target, String methodName, Class[] parms, Object[] args) {
+ Method method;
+ try {
+ method = target.getClass().getMethod(methodName, parms);
+ if (method != null) {
+ return method.invoke(target, parms, args);
+ }
+ } catch (SecurityException e) {
+ reflectionException(e);
+ } catch (NoSuchMethodException e) {
+ reflectionException(e);
+ } catch (IllegalArgumentException e) {
+ reflectionException(e);
+ } catch (IllegalAccessException e) {
+ reflectionException(e);
+ } catch (InvocationTargetException e) {
+ reflectionException(e);
+ }
+ return null;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/MANIFEST.MF b/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/MANIFEST.MF
new file mode 100755
index 0000000000..bb72ca36e5
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tuscany_binding_osgi Plug-in
+Bundle-SymbolicName: tuscany_binding_osgi
+Bundle-Version: 1.0.0
+Bundle-Activator: org.apache.tuscany.binding.osgi.LauncherActivator
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.1",
+ org.osoa.sca,
+ org.osoa.sca.annotations
+Require-Bundle: tuscany.osgi.sca.spi,
+ tuscany_external_dependencies,
+ tuscany.osgi.sca.core
diff --git a/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/sca/osgibinding.scdl b/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/sca/osgibinding.scdl
new file mode 100755
index 0000000000..94dca99a73
--- /dev/null
+++ b/sandbox/old/contrib/binding-osgi/src/main/resources/META-INF/sca/osgibinding.scdl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="binding.osgi">
+
+ <component name="osgi.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.osgOSGiBindingBuilderi.binding.OSGiBindingLoader"/>
+ </component>
+ <component name="osgi.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.osgi.binding.OSGiBindingBuilder"/>
+ </component>
+ <component name="osgi.componentLoader">
+ <system:implementation.system class="org.apache.tuscany.implementation.osgi.OSGiImplementationLoader"/>
+ </component>
+ <component name="osgi.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.implementation.osgi.OSGiComponentTypeLoader"/>
+ </component>
+ <component name="osgi.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.implementation.osgi.OSGiComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-servicemix/binding/pom.xml.off b/sandbox/old/contrib/binding-servicemix/binding/pom.xml.off
new file mode 100644
index 0000000000..12f3840dd0
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/pom.xml.off
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>binding-servicemix</artifactId>
+ <name>Apache Tuscany Binding for ServiceMix</name>
+ <description>Implementation of the SCA JBI Binding</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-core</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-common</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java
new file mode 100644
index 0000000000..ad407553b4
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Bootstrap;
+import javax.jbi.component.InstallationContext;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * Base class for components bootstrap.
+ *
+ * @author Guillaume Nodet
+ * @version $Revision$
+ * @since 3.0
+ */
+public class ScaBootstrap implements Bootstrap {
+
+ protected final transient Log logger = LogFactory.getLog(getClass());
+
+ protected InstallationContext context;
+ protected ObjectName mbeanName;
+
+ public ScaBootstrap() {
+ }
+
+ public ObjectName getExtensionMBeanName() {
+ return mbeanName;
+ }
+
+ protected Object getExtensionMBean() throws Exception {
+ return null;
+ }
+
+ protected ObjectName createExtensionMBeanName() throws Exception {
+ return this.context.getContext().getMBeanNames().createCustomComponentMBeanName("bootstrap");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jbi.component.Bootstrap#init(javax.jbi.component.InstallationContext)
+ */
+ public void init(InstallationContext installContext) throws JBIException {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Initializing bootstrap");
+ }
+ this.context = installContext;
+ doInit();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap initialized");
+ }
+ } catch (JBIException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new JBIException("Error calling init", e);
+ }
+ }
+
+ protected void doInit() throws Exception {
+ Object mbean = getExtensionMBean();
+ if (mbean != null) {
+ this.mbeanName = createExtensionMBeanName();
+ MBeanServer server = this.context.getContext().getMBeanServer();
+ if (server == null) {
+ throw new JBIException("null mBeanServer");
+ }
+ if (server.isRegistered(this.mbeanName)) {
+ server.unregisterMBean(this.mbeanName);
+ }
+ server.registerMBean(mbean, this.mbeanName);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jbi.component.Bootstrap#cleanUp()
+ */
+ public void cleanUp() throws JBIException {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up bootstrap");
+ }
+ doCleanUp();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap cleaned up");
+ }
+ } catch (JBIException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new JBIException("Error calling cleanUp", e);
+ }
+ }
+
+ protected void doCleanUp() throws Exception {
+ if (this.mbeanName != null) {
+ MBeanServer server = this.context.getContext().getMBeanServer();
+ if (server == null) {
+ throw new JBIException("null mBeanServer");
+ }
+ if (server.isRegistered(this.mbeanName)) {
+ server.unregisterMBean(this.mbeanName);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jbi.component.Bootstrap#onInstall()
+ */
+ public void onInstall() throws JBIException {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap onInstall");
+ }
+ doOnInstall();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap onInstall done");
+ }
+ } catch (JBIException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new JBIException("Error calling onInstall", e);
+ }
+ }
+
+ protected void doOnInstall() throws Exception {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jbi.component.Bootstrap#onUninstall()
+ */
+ public void onUninstall() throws JBIException {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap onUninstall");
+ }
+ doOnUninstall();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bootstrap onUninstall done");
+ }
+ } catch (JBIException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new JBIException("Error calling onUninstall", e);
+ }
+ }
+
+ protected void doOnUninstall() throws Exception {
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaComponent.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaComponent.java
new file mode 100644
index 0000000000..93470e0707
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaComponent.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+import org.apache.servicemix.common.BaseServiceUnitManager;
+import org.apache.servicemix.common.Deployer;
+
+public class ScaComponent extends BaseComponent {
+
+ /* (non-Javadoc)
+ * @see org.servicemix.common.BaseComponent#createLifeCycle()
+ */
+ protected BaseLifeCycle createLifeCycle() {
+ return new ScaLifeCycle(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+ */
+ public BaseServiceUnitManager createServiceUnitManager() {
+ Deployer[] deployers = new Deployer[] { new ScaDeployer(this) };
+ return new BaseServiceUnitManager(this, deployers);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaDeployer.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaDeployer.java
new file mode 100644
index 0000000000..199721cb88
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaDeployer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import java.io.File;
+
+import javax.jbi.management.DeploymentException;
+
+import org.apache.servicemix.common.AbstractDeployer;
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.ServiceUnit;
+
+public class ScaDeployer extends AbstractDeployer {
+
+ public static final String SCA_MODULE_FILE = "sca.module";
+
+ public ScaDeployer(BaseComponent component) {
+ super(component);
+ }
+
+ public boolean canDeploy(String serviceUnitName, String serviceUnitRootPath) {
+ File module = new File(serviceUnitRootPath, SCA_MODULE_FILE);
+ return module.exists() && module.isFile();
+ }
+
+ public ServiceUnit deploy(String serviceUnitName, String serviceUnitRootPath)
+ throws DeploymentException {
+ File module = new File(serviceUnitRootPath, SCA_MODULE_FILE);
+ if (!module.exists() || !module.isFile()) {
+ throw failure("deploy", "No sca.module found", null);
+ }
+ try {
+ ScaServiceUnit su = new ScaServiceUnit();
+ su.setComponent(component);
+ su.setName(serviceUnitName);
+ su.setRootPath(serviceUnitRootPath);
+ su.init();
+ return su;
+ } catch (Exception e) {
+ throw failure("deploy", "Error loading sca module", e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java
new file mode 100644
index 0000000000..8da798d26f
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import java.io.StringWriter;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.tuscany.core.context.EntryPointContext;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ *
+ * @author gnodet
+ * @version $Revision$
+ * @org.apache.xbean.XBean element="endpoint" description="A sca endpoint"
+ *
+ */
+public class ScaEndpoint extends Endpoint implements ExchangeProcessor {
+
+ protected ServiceEndpoint activated;
+
+ protected EntryPoint entryPoint;
+
+ protected Map<Class, Method> methodMap;
+
+ protected JAXBContext jaxbContext;
+
+ protected DeliveryChannel channel;
+
+ public ScaEndpoint(EntryPoint entryPoint) {
+ this.entryPoint = entryPoint;
+ }
+
+ public Role getRole() {
+ return Role.PROVIDER;
+ }
+
+ public void activate() throws Exception {
+ logger = this.serviceUnit.getComponent().getLogger();
+ ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+ activated = ctx.activateEndpoint(service, endpoint);
+ channel = ctx.getDeliveryChannel();
+ // Get the target service
+ ConfiguredReference referenceValue = entryPoint.getConfiguredReference();
+ ConfiguredService targetServiceEndpoint = referenceValue.getTargetConfiguredServices().get(0);
+ // Get the business interface
+ Class serviceInterface = targetServiceEndpoint.getService().getServiceContract().getInterface();
+ List<Class> classes = new ArrayList<Class>();
+ methodMap = new HashMap<Class, Method>();
+ for (Method mth : serviceInterface.getMethods()) {
+ Class[] params = mth.getParameterTypes();
+ if (params.length != 1) {
+ throw new IllegalStateException("Supports only methods with one parameter");
+ }
+ methodMap.put(params[0], mth);
+ classes.add(mth.getReturnType());
+ classes.add(params[0]);
+ }
+ jaxbContext = JAXBContext.newInstance(classes.toArray(new Class[0]));
+ }
+
+ public void deactivate() throws Exception {
+ ServiceEndpoint ep = activated;
+ activated = null;
+ ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+ ctx.deactivateEndpoint(ep);
+ }
+
+ public ExchangeProcessor getProcessor() {
+ return this;
+ }
+
+ public void process(MessageExchange exchange) throws Exception {
+ if (exchange.getStatus() == ExchangeStatus.DONE) {
+ return;
+ } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+ return;
+ }
+ Object input = jaxbContext.createUnmarshaller().unmarshal(exchange.getMessage("in").getContent());
+ Method method = methodMap.get(input.getClass());
+ if (method == null) {
+ throw new IllegalStateException("Could not determine invoked web method");
+ }
+ boolean oneWay = method.getReturnType() == null;
+ Object output;
+ try {
+ EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
+ .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
+ InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
+ output = handler.invoke(null, method, new Object[] { input });
+ } catch (UndeclaredThrowableException e) {
+ throw e;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Error e) {
+ throw e;
+ } catch (Exception e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ if (oneWay) {
+ exchange.setStatus(ExchangeStatus.DONE);
+ channel.send(exchange);
+ } else {
+ NormalizedMessage msg = exchange.createMessage();
+ exchange.setMessage(msg, "out");
+ StringWriter writer = new StringWriter();
+ jaxbContext.createMarshaller().marshal(output, writer);
+ msg.setContent(new StringSource(writer.toString()));
+ channel.send(exchange);
+ }
+ }
+
+ public void start() throws Exception {
+ }
+
+ public void stop() throws Exception {
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
new file mode 100644
index 0000000000..499459dc71
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+
+public class ScaLifeCycle extends BaseLifeCycle {
+
+ public ScaLifeCycle(BaseComponent component) {
+ super(component);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
new file mode 100644
index 0000000000..e391edf071
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.tuscany.CommonsLoggingMonitorFactory;
+import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+
+public class ScaServiceUnit extends ServiceUnit {
+
+ protected static final ThreadLocal<ScaServiceUnit> SERVICE_UNIT = new ThreadLocal<ScaServiceUnit>();
+
+ public static ScaServiceUnit getCurrentScaServiceUnit() {
+ return SERVICE_UNIT.get();
+ }
+
+ protected TuscanyRuntime tuscanyRuntime;
+ protected ClassLoader classLoader;
+
+ public void init() throws Exception {
+ SERVICE_UNIT.set(this);
+ createScaRuntime();
+ createEndpoints();
+ SERVICE_UNIT.set(null);
+ }
+
+ protected void createScaRuntime() throws Exception {
+ File root = new File(getRootPath());
+ File[] files = root.listFiles(new JarFileFilter());
+ URL[] urls = new URL[files.length + 1];
+ for (int i = 0; i < files.length; i++) {
+ urls[i] = files[i].toURL();
+ }
+ urls[urls.length - 1] = root.toURL();
+ classLoader = new URLClassLoader(urls, getClass().getClassLoader());
+
+ tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
+ }
+
+ protected void createEndpoints() throws Exception {
+ Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
+ for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
+ EntryPoint entryPoint = (EntryPoint) i.next();
+ Binding binding = (Binding) entryPoint.getBindings().get(0);
+ if (binding instanceof JbiBinding) {
+ JbiBinding jbiBinding = (JbiBinding) binding;
+ ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
+ endpoint.setServiceUnit(this);
+ endpoint.setService(jbiBinding.getServiceName());
+ endpoint.setEndpoint(jbiBinding.getEndpointName());
+ endpoint.setInterfaceName(jbiBinding.getInterfaceName());
+ Definition definition = jbiBinding.getDefinition();
+ if (definition != null) {
+ endpoint.setDefinition(definition);
+ endpoint.setDescription(WSDLFactory.newInstance().newWSDLWriter().getDocument(definition));
+ }
+ addEndpoint(endpoint);
+ }
+ }
+ }
+
+ private static class JarFileFilter implements FilenameFilter {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ }
+
+ public TuscanyRuntime getTuscanyRuntime() {
+ return tuscanyRuntime;
+ }
+
+ @Override
+ public void start() throws Exception {
+ tuscanyRuntime.start();
+ super.start();
+ }
+
+ @Override
+ public void stop() throws Exception {
+ super.stop();
+ tuscanyRuntime.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
new file mode 100644
index 0000000000..ef7812f175
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.assembly;
+
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+
+/**
+ * The <b>Factory</b> for the model.
+ */
+public interface JbiAssemblyFactory extends AssemblyFactory {
+
+ /**
+ * Returns a new JbiBinding
+ */
+ JbiBinding createJbiBinding();
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
new file mode 100644
index 0000000000..8bfbf80590
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.assembly;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.model.assembly.Binding;
+
+public interface JbiBinding extends Binding {
+
+ /**
+ * Returns the URI of the WSDL port for this binding.
+ * @return the URI of the WSDL port for this binding
+ */
+ String getPortURI();
+
+ /**
+ * Set the URI of the WSDL port for this binding.
+ * @param portURI the URI of the WSDL port
+ */
+ void setPortURI(String portURI);
+
+ /**
+ * Returns the service name.
+ * @return the service name
+ */
+ QName getServiceName();
+
+ /**
+ * Returns the endpoint name.
+ * @return the endpoint name
+ */
+ String getEndpointName();
+
+ /**
+ * Returns the interface name.
+ * @returnthe interface name
+ */
+ QName getInterfaceName();
+
+ /**
+ * Returns the WSDL definition containing the WSDL port.
+ * @return the WSDL definition containing the WSDL port
+ */
+ Definition getDefinition();
+
+ /**
+ * Returns the the WSDL service.
+ * @return the WSDL service
+ */
+ Service getService();
+
+ /**
+ * Returns the WSDL port defining this binding.
+ * @return the WSDL port defining this binding
+ */
+ Port getPort();
+
+ /**
+ * Returns the WSDL port type.
+ * @return the WSDL port type
+ */
+ PortType getPortType();
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
new file mode 100644
index 0000000000..4cd6a98689
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.assembly.impl;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+
+/**
+ * An implementation of the model <b>Factory</b>.
+ */
+public class JbiAssemblyFactoryImpl extends AssemblyFactoryImpl implements JbiAssemblyFactory {
+
+ /**
+ * Creates an instance of the factory.
+ */
+ public JbiAssemblyFactoryImpl() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiAssemblyFactory#createJbiBinding()
+ */
+ public JbiBinding createJbiBinding() {
+ return new JbiBindingImpl();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
new file mode 100644
index 0000000000..e44b9c6f45
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.assembly.impl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.impl.BindingImpl;
+
+/**
+ * An implementation of the model object '<em><b>Web Service Binding</b></em>'.
+ */
+public class JbiBindingImpl extends BindingImpl implements JbiBinding {
+
+ private String portURI;
+ private QName serviceName;
+ private String endpointName;
+ private QName interfaceName;
+ private Definition definition;
+ private Service service;
+ private PortType portType;
+ private Port port;
+
+
+ /**
+ * Constructor
+ */
+ protected JbiBindingImpl() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortURI()
+ */
+ public String getPortURI() {
+ return portURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#setPortURI(java.lang.String)
+ */
+ public void setPortURI(String portURI) {
+ this.portURI = portURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getServiceName()
+ */
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getEndpointName()
+ */
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getInterfaceName()
+ */
+ public QName getInterfaceName() {
+ return interfaceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getDefinition()
+ */
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getService()
+ */
+ public Service getService() {
+ return service;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPort()
+ */
+ public Port getPort() {
+ return port;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortType()
+ */
+ public PortType getPortType() {
+ return portType;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Get the service name and endpoint name
+ String[] parts = split(portURI);
+ serviceName = new QName(parts[0], parts[1]);
+ endpointName = parts[2];
+
+ // Load the WSDL definitions for the given namespace
+ List<Definition> definitions = modelContext.getAssemblyLoader().loadDefinitions(parts[0]);
+ if (definitions != null) {
+ for (Definition definition : definitions) {
+ Service service = definition.getService(serviceName);
+ if (service != null) {
+ Port port = service.getPort(endpointName);
+ if (port != null) {
+ this.service = service;
+ this.port = port;
+ this.portType = port.getBinding().getPortType();
+ this.interfaceName = portType.getQName();
+ this.definition = definition;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ protected String[] split(String uri) {
+ char sep;
+ uri = uri.trim();
+ if (uri.indexOf('/') > 0) {
+ sep = '/';
+ } else {
+ sep = ':';
+ }
+ int idx1 = uri.lastIndexOf(sep);
+ int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+ String epName = uri.substring(idx1 + 1);
+ String svcName = uri.substring(idx2 + 1, idx1);
+ String nsUri = uri.substring(0, idx2);
+ return new String[] { nsUri, svcName, epName };
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
new file mode 100644
index 0000000000..e5a7b59a75
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceClient;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.MethodHashMap;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.scdl.WebServiceBinding;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Creates a <code>RuntimeConfigurationBuilder</code> for an external service configured with the {@link WebServiceBinding}
+ */
+@Scope("MODULE")
+public class ExternalJbiServiceBuilder implements ContextFactoryBuilder {
+
+ private RuntimeContext runtimeContext;
+
+ private ProxyFactoryFactory proxyFactoryFactory;
+
+ private MessageFactory messageFactory;
+
+ private ContextFactoryBuilder policyBuilder;
+
+ public ExternalJbiServiceBuilder() {
+ }
+
+ @Init(eager = true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ /**
+ * @param runtimeContext The runtimeContext to set.
+ */
+ @Autowire
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ /**
+ * Sets the factory used to construct proxies implmementing the business interface required by a reference
+ */
+ @Autowire
+ public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
+ this.proxyFactoryFactory = factory;
+ }
+
+ /**
+ * Sets the factory used to construct invocation messages
+ *
+ * @param msgFactory
+ */
+ @Autowire
+ public void setMessageFactory(MessageFactory msgFactory) {
+ this.messageFactory = msgFactory;
+ }
+
+ /**
+ * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
+ * reference builder may be hierarchical, containing other child reference builders that operate on specific
+ * metadata used to construct and invocation chain.
+ *
+ * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
+ */
+ public void setPolicyBuilder(ContextFactoryBuilder builder) {
+ policyBuilder = builder;
+ }
+
+ public void build(AssemblyModelObject object) throws BuilderException {
+ if (!(object instanceof ExternalService)) {
+ return;
+ }
+ ExternalService externalService = (ExternalService) object;
+ if (externalService.getBindings().size() < 1 || !(externalService.getBindings().get(0) instanceof JbiBinding)) {
+ return;
+ }
+
+ ExternalJbiServiceClient externalJbiServiceClient = new ExternalJbiServiceClient(externalService);
+ ExternalJbiServiceContextFactory config = new ExternalJbiServiceContextFactory(externalService.getName(), new SingletonObjectFactory<ExternalJbiServiceClient>(externalJbiServiceClient));
+
+ ConfiguredService configuredService = externalService.getConfiguredService();
+ Service service = configuredService.getService();
+ ServiceContract serviceContract = service.getServiceContract();
+ Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap();
+ ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
+ Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
+ for (Method method : javaMethods) {
+ InvocationConfiguration iConfig = new InvocationConfiguration(method);
+ iConfigMap.put(method, iConfig);
+ }
+ QualifiedName qName = new QualifiedName(externalService.getName() + "/" + service.getName());
+ ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+ proxyFactory.setBusinessInterface(serviceContract.getInterface());
+ proxyFactory.setProxyConfiguration(pConfiguration);
+ config.addTargetProxyFactory(service.getName(), proxyFactory);
+ configuredService.setProxyFactory(proxyFactory);
+ if (policyBuilder != null) {
+ // invoke the reference builder to handle additional policy metadata
+ policyBuilder.build(configuredService);
+ }
+ // add tail interceptor
+ for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+ iConfig.addTargetInterceptor(new InvokerInterceptor());
+ }
+
+ externalService.getConfiguredService().setContextFactory(config);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
new file mode 100644
index 0000000000..1dc7d9f454
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.builder;
+
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceTargetInvoker;
+import org.apache.tuscany.core.builder.BuilderConfigException;
+import org.apache.tuscany.core.builder.WireBuilder;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class ExternalJbiServiceWireBuilder implements WireBuilder {
+
+ private RuntimeContext runtimeContext;
+
+ /**
+ * Constructs a new ExternalWebServiceWireBuilder.
+ */
+ public ExternalJbiServiceWireBuilder() {
+ super();
+ }
+
+ @Autowire
+ public void setRuntimeContext(RuntimeContext context) {
+ runtimeContext = context;
+ }
+
+ @Init(eager=true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException {
+ if (!(ExternalJbiServiceContextFactory.class.isAssignableFrom(targetType))) {
+ return;
+ }
+ for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) {
+ ExternalJbiServiceTargetInvoker invoker = new ExternalJbiServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
+ sourceInvocationConfig.setTargetInvoker(invoker);
+ }
+ }
+
+ public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
+ throws BuilderConfigException {
+ //TODO implement
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
new file mode 100644
index 0000000000..af83c7c714
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.JbiServiceEntryPointContextFactory;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.InvocationRuntimeException;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiServiceEntryPointBuilder implements ContextFactoryBuilder<AggregateContext> {
+
+ private RuntimeContext runtimeContext;
+
+ private ProxyFactoryFactory proxyFactoryFactory;
+
+ private MessageFactory messageFactory;
+
+ private ContextFactoryBuilder policyBuilder;
+
+ public JbiServiceEntryPointBuilder() {
+ }
+
+ @Init(eager = true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ /**
+ * @param runtimeContext The runtimeContext to set.
+ */
+ @Autowire
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ /**
+ * Sets the factory used to construct proxies implmementing the business interface required by a reference
+ */
+ @Autowire
+ public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
+ this.proxyFactoryFactory = factory;
+ }
+
+ /**
+ * Sets the factory used to construct invocation messages
+ *
+ * @param msgFactory
+ */
+ @Autowire
+ public void setMessageFactory(MessageFactory msgFactory) {
+ this.messageFactory = msgFactory;
+ }
+
+ /**
+ * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
+ * reference builder may be hierarchical, containing other child reference builders that operate on specific
+ * metadata used to construct and invocation chain.
+ *
+ * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
+ */
+ public void setPolicyBuilder(ContextFactoryBuilder builder) {
+ policyBuilder = builder;
+ }
+
+ public void build(AssemblyModelObject object) throws BuilderException {
+ if (!(object instanceof EntryPoint)) {
+ return;
+ }
+ EntryPoint entryPoint = (EntryPoint) object;
+ if (entryPoint.getBindings().size() < 1 || !(entryPoint.getBindings().get(0) instanceof JbiBinding)) {
+ return;
+ }
+
+ EntryPointContextFactory config = new JbiServiceEntryPointContextFactory(entryPoint.getName(), entryPoint.getConfiguredService().getService().getName(), messageFactory);
+
+ ConfiguredService configuredService = entryPoint.getConfiguredService();
+ Service service = configuredService.getService();
+ ServiceContract serviceContract = service.getServiceContract();
+ Map<Method, InvocationConfiguration> iConfigMap = new HashMap<Method, InvocationConfiguration>();
+ ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
+ Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
+ for (Method method : javaMethods) {
+ InvocationConfiguration iConfig = new InvocationConfiguration(method);
+ iConfigMap.put(method, iConfig);
+ }
+ QualifiedName qName = new QualifiedName(entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + "/" + service.getName());
+ ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+ proxyFactory.setBusinessInterface(serviceContract.getInterface());
+ proxyFactory.setProxyConfiguration(pConfiguration);
+ config.addSourceProxyFactory(service.getName(), proxyFactory);
+ configuredService.setProxyFactory(proxyFactory);
+ if (policyBuilder != null) {
+ // invoke the reference builder to handle additional policy metadata
+ policyBuilder.build(configuredService);
+ }
+ // add tail interceptor
+ for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+ iConfig.addTargetInterceptor(new EntryPointInvokerInterceptor());
+ }
+ entryPoint.getConfiguredReference().setContextFactory(config);
+ }
+
+ //FIXME same as the InvokerInterceptor except that it doesn't throw an exception in setNext
+ // For some reason another InvokerInterceptor is added after this one, need Jim to look into it
+ // and figure out why.
+ public class EntryPointInvokerInterceptor implements Interceptor {
+
+ public EntryPointInvokerInterceptor() {
+ }
+
+ 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) {
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
new file mode 100644
index 0000000000..93b846db8a
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.ObjectFactory;
+import org.apache.tuscany.core.builder.impl.BaseExternalServiceContextFactory;
+
+public class ExternalJbiServiceContextFactory extends BaseExternalServiceContextFactory {
+
+ public ExternalJbiServiceContextFactory(String name, ObjectFactory objectFactory) {
+ super(name, objectFactory);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
new file mode 100644
index 0000000000..b6adb6481d
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+
+public class JbiServiceEntryPointContextFactory extends EntryPointContextFactory {
+
+ public JbiServiceEntryPointContextFactory(String name, String referenceName, MessageFactory msgFactory) {
+ super(name, referenceName, msgFactory);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
new file mode 100644
index 0000000000..22b457687f
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.handler;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Method;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.sca.ScaServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.ExternalService;
+
+public class ExternalJbiServiceClient {
+
+ private ExternalService externalService;
+
+ private JbiBinding jbiBinding;
+
+ private ScaServiceUnit serviceUnit;
+
+ /**
+ * Constructs a new ExternalWebServiceClient.
+ *
+ * @param externalService
+ * @param wsBinding
+ */
+ public ExternalJbiServiceClient(ExternalService externalService) {
+ this.serviceUnit = ScaServiceUnit.getCurrentScaServiceUnit();
+ this.externalService = externalService;
+ this.jbiBinding = (JbiBinding) this.externalService.getBindings().get(0);
+ }
+
+ /**
+ * Invoke an operation on the external Web service.
+ *
+ * @param method
+ * @param args
+ * @return
+ */
+ public Object invoke(Method method, Object[] args) {
+ if (args == null || args.length != 1) {
+ throw new IllegalStateException("args should have exactly one object");
+ }
+ try {
+ Object payload = args[0];
+ Class inputClass = method.getParameterTypes()[0];
+ Class outputClass = method.getReturnType();
+ JAXBContext context = JAXBContext.newInstance(inputClass, outputClass);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ context.createMarshaller().marshal(payload, baos);
+
+ DeliveryChannel channel = serviceUnit.getComponent().getComponentContext().getDeliveryChannel();
+ // TODO: in-only case ?
+ // TODO: interface based routing ?
+ // TODO: explicit endpoint selection ?
+ InOut inout = channel.createExchangeFactory().createInOutExchange();
+ inout.setService(jbiBinding.getServiceName());
+ NormalizedMessage in = inout.createMessage();
+ inout.setInMessage(in);
+ in.setContent(new StringSource(baos.toString()));
+ boolean sent = channel.sendSync(inout);
+ // TODO: check for error ?
+ NormalizedMessage out = inout.getOutMessage();
+ Object response = context.createUnmarshaller().unmarshal(out.getContent());
+ inout.setStatus(ExchangeStatus.DONE);
+ channel.send(inout);
+ return response;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
new file mode 100644
index 0000000000..cd0560c5b5
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.handler;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.context.ExternalServiceContext;
+import org.apache.tuscany.core.context.InstanceContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.context.TargetException;
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.message.Message;
+
+public class ExternalJbiServiceTargetInvoker implements TargetInvoker {
+
+ private QualifiedName serviceName;
+ private String esName;
+ private Method method;
+ private ScopeContext container;
+
+ private ExternalServiceContext context;
+
+ /**
+ * Constructs a new ExternalJbiServiceTargetInvoker.
+ * @param esName
+ * @param container
+ */
+ public ExternalJbiServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
+ assert (serviceName != null) : "No service name specified";
+ assert (method != null) : "No method specified";
+ assert (container != null) : "No scope container specified";
+ this.serviceName = serviceName;
+ this.esName = serviceName.getPartName();
+ this.method = method;
+ this.container = container;
+ }
+
+ public Object invokeTarget(Object payload) throws InvocationTargetException {
+ if (context == null) {
+ InstanceContext iContext = container.getContext(esName);
+ if (!(iContext instanceof ExternalServiceContext)) {
+ TargetException te = new TargetException("Unexpected target context type");
+ te.setIdentifier(iContext.getClass().getName());
+ te.addContextName(iContext.getName());
+ throw te;
+ }
+ context = (ExternalServiceContext) iContext;
+ }
+ ExternalJbiServiceClient client = (ExternalJbiServiceClient) context.getImplementationInstance(true);
+ if (payload != null) {
+ return client.invoke(method, (Object[])payload);
+ } else {
+ return client.invoke(method, null);
+ }
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setBody(e);
+ }
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object clone() {
+ try {
+ ExternalJbiServiceTargetInvoker invoker = (ExternalJbiServiceTargetInvoker) super.clone();
+ invoker.container = container;
+ invoker.context = this.context;
+ invoker.esName = this.esName;
+ invoker.method = this.method;
+ invoker.serviceName = this.serviceName;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java
new file mode 100644
index 0000000000..ac67433720
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.assembly.impl.JbiAssemblyFactoryImpl;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.loader.StAXElementLoader;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiBindingLoader implements StAXElementLoader<JbiBinding>{
+
+ public static final QName BINDING_JBI = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.jbi");
+
+ private static final JbiAssemblyFactory jbiFactory = new JbiAssemblyFactoryImpl();
+
+ private StAXLoaderRegistry registry;
+
+ @Autowire
+ public void setRegistry(StAXLoaderRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init(eager = true)
+ public void start() {
+ registry.registerLoader(this);
+ }
+
+ @Destroy
+ public void stop() {
+ registry.unregisterLoader(this);
+ }
+
+ public QName getXMLType() {
+ return BINDING_JBI;
+ }
+
+ public Class<JbiBinding> getModelType() {
+ return JbiBinding.class;
+ }
+
+ public JbiBinding load(XMLStreamReader reader, ResourceLoader resourceLoader) throws XMLStreamException, ConfigurationLoadException {
+ JbiBinding binding = jbiFactory.createJbiBinding();
+ binding.setURI(reader.getAttributeValue(null, "uri"));
+ binding.setPortURI(reader.getAttributeValue(null, "port"));
+ return binding;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java
new file mode 100644
index 0000000000..154afe4377
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.tuscany;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.config.impl.ModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.loader.StAXUtil;
+import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
+import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder;
+import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder;
+import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder;
+import org.apache.tuscany.core.system.loader.SystemSCDLModelLoader;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl;
+
+public class BootstrapHelper {
+
+ /**
+ * Returns a default AssemblyModelContext.
+ *
+ * @param classLoader the classloader to use for application artifacts
+ * @return a default AssemblyModelContext
+ */
+ public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
+ // Create an assembly model factory
+ AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();
+
+ // Create a default assembly model loader
+ List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
+ scdlLoaders.add(new SystemSCDLModelLoader());
+ AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
+
+ // Create a resource loader from the supplied classloader
+ ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);
+
+ // Create an assembly model context
+ return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
+ }
+
+ /**
+ * Returns a default list of configuration builders.
+ *
+ * @return a default list of configuration builders
+ */
+ public static List<ContextFactoryBuilder> getBuilders() {
+ List<ContextFactoryBuilder> configBuilders = new ArrayList<ContextFactoryBuilder>();
+ configBuilders.add((new SystemContextFactoryBuilder()));
+ configBuilders.add(new SystemEntryPointBuilder());
+ configBuilders.add(new SystemExternalServiceBuilder());
+ return configBuilders;
+ }
+
+ private static final boolean useStax = true;
+ private static final String SYSTEM_LOADER_COMPONENT = "tuscany.loader";
+
+ /**
+ * Returns the default module configuration loader.
+ *
+ * @param systemContext the runtime's system context
+ * @param modelContext the model context the loader will use
+ * @return the default module configuration loader
+ */
+ public static ModuleComponentConfigurationLoader getConfigurationLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+ if (useStax) {
+ // Bootstrap the StAX loader module
+ bootstrapStaxLoader(systemContext, modelContext);
+ return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class));
+ } else {
+ return new ModuleComponentConfigurationLoaderImpl(modelContext);
+ }
+ }
+
+ private static AggregateContext bootstrapStaxLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+ AggregateContext loaderContext = (AggregateContext) systemContext.getContext(SYSTEM_LOADER_COMPONENT);
+ if (loaderContext == null) {
+ ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext);
+ loaderContext = registerModule(systemContext, loaderComponent);
+ loaderContext.fireEvent(EventContext.MODULE_START, null);
+ }
+ return loaderContext;
+ }
+
+ public static AggregateContext registerModule(AggregateContext parent, ModuleComponent component) throws ConfigurationException {
+ // register the component
+ parent.registerModelObject(component);
+
+ // Get the aggregate context representing the component
+ return (AggregateContext) parent.getContext(component.getName());
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
new file mode 100644
index 0000000000..04bcc0bcea
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.tuscany;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+
+public class CommonsLoggingMonitorFactory implements MonitorFactory {
+
+ private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
+
+ public CommonsLoggingMonitorFactory() {
+ }
+
+ public <T> T getMonitor(Class<T> monitorInterface) {
+ T proxy = getCachedMonitor(monitorInterface);
+ if (proxy == null) {
+ proxy = createMonitor(monitorInterface);
+ proxies.put(monitorInterface, new WeakReference<T>(proxy));
+ }
+ return proxy;
+ }
+
+ private <T>T getCachedMonitor(Class<T> monitorInterface) {
+ WeakReference<T> ref = (WeakReference<T>) proxies.get(monitorInterface);
+ return (ref != null) ? ref.get() : null;
+ }
+
+ private <T>T createMonitor(Class<T> monitorInterface) {
+ String className = monitorInterface.getName();
+ Log logger = LogFactory.getLog(className);
+ InvocationHandler handler = new LoggingHandler(logger);
+ return (T) Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler);
+ }
+
+ private static final class LoggingHandler implements InvocationHandler {
+ private final Log logger;
+
+ public LoggingHandler(Log logger) {
+ this.logger = logger;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ String sourceMethod = method.getName();
+ if (logger.isDebugEnabled()) {
+ // if the only argument is a Throwable use the special logger for it
+ if (args != null && args.length == 1 && args[0] instanceof Throwable) {
+ logger.debug(sourceMethod, (Throwable) args[0]);
+ } else {
+ StringBuilder sb = new StringBuilder();
+ sb.append(sourceMethod);
+ sb.append("(");
+ for (int i = 0; i < args.length; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(args[i]);
+ }
+ sb.append(")");
+ logger.debug(sb.toString());
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
new file mode 100644
index 0000000000..ee5960dfb5
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.tuscany;
+
+import java.util.List;
+
+import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.CoreRuntimeException;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.runtime.RuntimeContextImpl;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.osoa.sca.ModuleContext;
+import org.osoa.sca.SCA;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class TuscanyRuntime extends SCA {
+ private final TuscanyRuntime.Monitor monitor;
+ private final Object sessionKey = new Object();
+
+ private final RuntimeContext runtime;
+ private final AggregateContext moduleContext;
+
+ private final ModuleComponent moduleComponent;
+
+ private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system";
+
+ /**
+ * Construct a runtime using a null MonitorFactory.
+ *
+ * @param name the name of the module component
+ * @param uri the URI to assign to the module component
+ * @throws ConfigurationException if there was a problem loading the SCA configuration
+ * @see TuscanyRuntime#TuscanyRuntime(String, String, org.apache.tuscany.common.monitor.MonitorFactory)
+ */
+ public TuscanyRuntime(String name, String uri) throws ConfigurationException {
+ this(name, uri,
+ Thread.currentThread().getContextClassLoader(),
+ new NullMonitorFactory());
+ }
+
+ /**
+ * Construct a runtime containing a single module component with the
+ * specified name. The module definition is loaded from a "/sca.module"
+ * resource found on the classpath of the current Thread context classloader.
+ *
+ * @param name the name of the module component
+ * @param uri the URI to assign to the module component
+ * @param classLoader the class loader to use for the assembly
+ * @param monitorFactory the MonitorFactory for this runtime
+ * @throws ConfigurationException if there was a problem loading the SCA configuration
+ */
+ public TuscanyRuntime(String name, String uri, ClassLoader classLoader, MonitorFactory monitorFactory) throws ConfigurationException {
+ this.monitor = monitorFactory.getMonitor(TuscanyRuntime.Monitor.class);
+
+ // Create an assembly model context
+ AssemblyModelContext modelContext = BootstrapHelper.getModelContext(classLoader);
+
+ // Create a runtime context and start it
+ List<SCDLModelLoader> loaders = modelContext.getAssemblyLoader().getLoaders();
+ List<ContextFactoryBuilder> configBuilders = BootstrapHelper.getBuilders();
+ runtime = new RuntimeContextImpl(monitorFactory, loaders, configBuilders, new DefaultWireBuilder());
+ runtime.start();
+ monitor.started(runtime);
+
+ // Load and start the system configuration
+ SystemAggregateContext systemContext = runtime.getSystemContext();
+ ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
+ ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
+ AggregateContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
+ context.fireEvent(EventContext.MODULE_START, null);
+
+ // Load the SCDL configuration of the application module
+ AggregateContext rootContext = runtime.getRootContext();
+ moduleComponent = loader.loadModuleComponent(name, uri);
+ moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);
+ }
+
+ public ModuleComponent getModuleComponent() {
+ return moduleComponent;
+ }
+
+ public AggregateContext getModuleContext() {
+ return moduleContext;
+ }
+
+ /**
+ * Start the runtime and associate the module context with the calling thread.
+ */
+ @Override
+ public void start() {
+ setModuleContext((ModuleContext) moduleContext);
+ try {
+ //moduleContext.start();
+ moduleContext.fireEvent(EventContext.MODULE_START, null);
+ moduleContext.fireEvent(EventContext.REQUEST_START, null);
+ moduleContext.fireEvent(EventContext.SESSION_NOTIFY, sessionKey);
+ monitor.started(moduleContext);
+ } catch (CoreRuntimeException e) {
+ setModuleContext(null);
+ monitor.startFailed(moduleContext, e);
+ //FIXME throw a better exception
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Disassociate the module context from the current thread and shut down the runtime.
+ */
+ @Override
+ public void stop() {
+ setModuleContext(null);
+ moduleContext.fireEvent(EventContext.REQUEST_END, null);
+ moduleContext.fireEvent(EventContext.SESSION_END, sessionKey);
+ moduleContext.fireEvent(EventContext.MODULE_STOP, null);
+ moduleContext.stop();
+ monitor.stopped(moduleContext);
+ runtime.stop();
+ monitor.stopped(runtime);
+ }
+
+ /**
+ * Monitor interface for a TuscanyRuntime.
+ */
+ public static interface Monitor {
+ /**
+ * Event emitted after the runtime has been started.
+ *
+ * @param ctx the runtime's module component context
+ */
+ void started(AggregateContext ctx);
+
+ /**
+ * Event emitted when an attempt to start the runtime failed.
+ *
+ * @param ctx the runtime's module component context
+ * @param e the exception that caused the failure
+ */
+ void startFailed(AggregateContext ctx, CoreRuntimeException e);
+
+ /**
+ * Event emitted after the runtime has been stopped.
+ *
+ * @param ctx the runtime's module component context
+ */
+ void stopped(AggregateContext ctx);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBinding.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBinding.java
new file mode 100644
index 0000000000..04781d6d69
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBinding.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import org.apache.tuscany.spi.model.Binding;
+
+/**
+ * Represents a JBI binding
+ */
+public class JBIBinding extends Binding {
+
+ private String uri;
+
+ private String port;
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBindingLoader.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBindingLoader.java
new file mode 100644
index 0000000000..8b6806a731
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/JBIBindingLoader.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.osoa.sca.annotations.Scope;
+
+/**
+ * Loader for handling <binding.jbi> elements.
+ */
+@Scope("MODULE")
+public class JBIBindingLoader extends LoaderExtension<JBIBinding> {
+
+ public static final QName BINDING_JBI = new QName("http://tuscany.apache.org/xmlns/binding/rmi/1.0-SNAPSHOT", "binding.jbi");
+
+ public JBIBindingLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return BINDING_JBI;
+ }
+
+ public JBIBinding load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+
+ String port = reader.getAttributeValue(null, "port");
+ String uri = reader.getAttributeValue(null, "uri");
+ LoaderUtil.skipToEndElement(reader);
+
+ JBIBinding binding = new JBIBinding();
+ binding.setPort(port);
+ binding.setURI(uri);
+
+ return binding;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixBuilder.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixBuilder.java
new file mode 100644
index 0000000000..227d56d0b7
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixBuilder.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing pejbissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.BindingBuilderExtension;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+
+/**
+ * Builds a Service or Reference for a JBI binding.
+ */
+public class ServiceMixBuilder extends BindingBuilderExtension<JBIBinding> {
+
+ protected Class<JBIBinding> getBindingType() {
+ return JBIBinding.class;
+ }
+
+ @SuppressWarnings( { "unchecked" })
+ public SCAObject build(CompositeComponent parent, BoundServiceDefinition<JBIBinding> boundServiceDefinition, DeploymentContext deploymentContext) {
+
+ String name = boundServiceDefinition.getName();
+
+ ServiceMixService serviceMixService = new ServiceMixService(name, parent, wireService, null);
+
+ return serviceMixService;
+ }
+
+ @SuppressWarnings( { "unchecked" })
+ public ServiceMixReference build(CompositeComponent parent, BoundReferenceDefinition<JBIBinding> boundReferenceDefinition,
+ DeploymentContext deploymentContext) {
+
+
+ ServiceMixReference serviceMixReference = new ServiceMixReference(null, parent, wireService, null, null);
+
+ return serviceMixReference;
+
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixInvoker.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixInvoker.java
new file mode 100644
index 0000000000..5ad2aae7b5
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixInvoker.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.sca.ScaServiceUnit;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+
+/**
+ * Invoke a JBI reference.
+ */
+public class ServiceMixInvoker extends TargetInvokerExtension {
+
+ private QName serviceName;
+
+ private ScaServiceUnit serviceUnit;
+
+ public ServiceMixInvoker(QName serviceName) {
+ this.serviceName = serviceName;
+ this.serviceUnit = ScaServiceUnit.getCurrentScaServiceUnit();
+ }
+
+ public Object invokeTarget(Object payload) throws InvocationTargetException {
+ try {
+ DeliveryChannel channel = serviceUnit.getComponent().getComponentContext().getDeliveryChannel();
+
+ // TODO: in-only case ?
+ // TODO: interface based routing ?
+ // TODO: explicit endpoint selection ?
+
+ InOut inout = channel.createExchangeFactory().createInOutExchange();
+ inout.setService(serviceName);
+ NormalizedMessage in = inout.createMessage();
+ inout.setInMessage(in);
+ in.setContent(new StringSource(payload.toString()));
+
+ boolean sent = channel.sendSync(inout);
+ // TODO: check for error ?
+
+ NormalizedMessage out = inout.getOutMessage();
+ Object response = out.getContent();
+ inout.setStatus(ExchangeStatus.DONE);
+ channel.send(inout);
+
+ return response;
+
+ } catch (MessagingException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixReference.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixReference.java
new file mode 100644
index 0000000000..e9898f8f15
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixReference.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceExtension;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ *
+ */
+public class ServiceMixReference<T> extends ReferenceExtension<T> {
+
+ private final String uri;
+
+ public ServiceMixReference(String name,
+ CompositeComponent<?> parent,
+ WireService wireService,
+ String uri,
+ Class<T> service)
+ {
+ super(name, service, parent, wireService);
+ setInterface(service);
+ this.uri = uri;
+ }
+
+ public TargetInvoker createTargetInvoker(Method arg0) {
+ QName serviceName = null;
+ ServiceMixInvoker invoker = new ServiceMixInvoker(serviceName);
+ return invoker;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixService.java b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixService.java
new file mode 100644
index 0000000000..ae7e9e3f1b
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/java/org/apache/tuscany/servicemix/ServiceMixService.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.servicemix;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ServiceExtension;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ *
+ */
+public class ServiceMixService<T> extends ServiceExtension<T> {
+
+ public ServiceMixService(String name, CompositeComponent parent, WireService wireService, Class<T> service) {
+ super(name, service, parent, wireService);
+ }
+
+ public void start() {
+ super.start();
+ }
+
+ public void stop() {
+ super.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/DISCLAIMER b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/DISCLAIMER
new file mode 100644
index 0000000000..14eddf5d92
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/DISCLAIMER
@@ -0,0 +1,6 @@
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo 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.
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/LICENSE b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/LICENSE
new file mode 100644
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/LICENSE
@@ -0,0 +1,203 @@
+
+ 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.
+
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/NOTICE b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/NOTICE
new file mode 100644
index 0000000000..c035229231
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/main/jbi/META-INF/NOTICE
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache ServiceMix distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Additional copyright notices and license terms applicable are
+ present in the licenses directory of this distribution.
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java
new file mode 100644
index 0000000000..2edf9882ec
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Module;
+
+/**
+ * @author delfinoj
+ */
+public class AssemblyLoaderTest extends TestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ }
+
+ public void testLoader() throws Exception {
+ String name = "bigbank";
+ String uri = getClass().getResource("bigbank/sca.module").toString();
+
+ URL url = getClass().getResource("bigbank/sca.module");
+ URL parentUrl = new File(url.toURI()).getParentFile().toURL();
+ ClassLoader cl = new URLClassLoader(new URL[] { parentUrl }, getClass().getClassLoader());
+
+ TuscanyRuntime rt = new TuscanyRuntime(name, uri, cl, new NullMonitorFactory());
+ assertNotNull(rt);
+
+ Module module = rt.getModuleComponent().getModuleImplementation();
+
+ Assert.assertTrue(module.getName().equals("org.apache.servicemix.sca.bigbank"));
+
+ Component component = module.getComponent("AccountServiceComponent");
+ Assert.assertTrue(component != null);
+
+ EntryPoint entryPoint = module.getEntryPoint("AccountService");
+ Assert.assertTrue(entryPoint != null);
+
+ ExternalService externalService = module.getExternalService("StockQuoteService");
+ Assert.assertTrue(externalService != null);
+
+ Binding binding = externalService.getBindings().get(0);
+ Assert.assertTrue(binding instanceof JbiBinding);
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java
new file mode 100644
index 0000000000..bd6c4b3e88
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.components.util.MockServiceComponent;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteResponse;
+import org.w3c.dom.Node;
+
+public class ScaComponentTest extends TestCase {
+
+ private static Log log = LogFactory.getLog(ScaComponentTest.class);
+
+ protected JBIContainer container;
+
+ protected void setUp() throws Exception {
+ container = new JBIContainer();
+ container.setUseMBeanServer(false);
+ container.setCreateMBeanServer(false);
+ container.setMonitorInstallationDirectory(false);
+ container.setNamingContext(new InitialContext());
+ container.setEmbedded(true);
+ container.init();
+ }
+
+ protected void tearDown() throws Exception {
+ if (container != null) {
+ container.shutDown();
+ }
+ }
+
+ public void testDeploy() throws Exception {
+ ScaComponent component = new ScaComponent();
+ container.activateComponent(component, "JSR181Component");
+
+ MockServiceComponent mock = new MockServiceComponent();
+ mock.setService(new QName("http://www.quickstockquote.com", "StockQuoteService"));
+ mock.setEndpoint("StockQuoteServiceJBI");
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ StockQuoteResponse r = new StockQuoteResponse();
+ r.setResult(8.23f);
+ JAXBContext.newInstance(StockQuoteResponse.class).createMarshaller().marshal(r, baos);
+ mock.setResponseXml(baos.toString());
+ ActivationSpec as = new ActivationSpec();
+ as.setComponent(mock);
+ container.activateComponent(as);
+
+ // Start container
+ container.start();
+
+ // Deploy SU
+ component.getServiceUnitManager().deploy("su", getServiceUnitPath("org/apache/servicemix/sca/bigbank"));
+ component.getServiceUnitManager().init("su", getServiceUnitPath("org/apache/servicemix/sca/bigbank"));
+ component.getServiceUnitManager().start("su");
+
+ ServiceMixClient client = new DefaultServiceMixClient(container);
+ Source req = new StringSource("<AccountReportRequest><CustomerID>id</CustomerID></AccountReportRequest>");
+ Object rep = client.request(new ServiceNameEndpointResolver(
+ new QName("http://sca.servicemix.apache.org/Bigbank/Account", "AccountService")),
+ null, null, req);
+ if (rep instanceof Node) {
+ rep = new DOMSource((Node) rep);
+ }
+ log.info(new SourceTransformer().toString((Source) rep));
+ }
+
+ protected String getServiceUnitPath(String name) {
+ URL url = getClass().getClassLoader().getResource(name + "/sca.module");
+ File path = new File(url.getFile());
+ path = path.getParentFile();
+ return path.getAbsolutePath();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java
new file mode 100644
index 0000000000..00c55aeffc
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.account;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "customerID" })
+@XmlRootElement(name = "AccountReportRequest")
+public class AccountReportRequest {
+
+ @XmlElement(name = "CustomerID")
+ private String customerID;
+
+ public String getCustomerID() {
+ return customerID;
+ }
+
+ public void setCustomerID(String customerID) {
+ this.customerID = customerID;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java
new file mode 100644
index 0000000000..f52985d2c1
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.account;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "accountSummaries" })
+@XmlRootElement(name = "AccountReportResponse")
+public class AccountReportResponse {
+
+ @XmlElement(name = "AccountSummaries")
+ private List<AccountSummary> accountSummaries;
+
+ public List<AccountSummary> getAccountSummaries() {
+ return accountSummaries;
+ }
+
+ public void setAccountSummaries(List<AccountSummary> accountSummaries) {
+ this.accountSummaries = accountSummaries;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..5c2997f2c3
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AccountService {
+
+ public AccountReportResponse getAccountReport(AccountReportRequest request);
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..f0cad13f5c
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.account;
+
+import java.util.ArrayList;
+
+import org.apache.servicemix.sca.bigbank.accountdata.AccountDataService;
+import org.apache.servicemix.sca.bigbank.accountdata.CheckingAccount;
+import org.apache.servicemix.sca.bigbank.accountdata.SavingsAccount;
+import org.apache.servicemix.sca.bigbank.accountdata.StockAccount;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteRequest;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteResponse;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces=AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ @Property
+ public String currency = "USD";
+
+ @Reference
+ public AccountDataService accountDataService;
+ @Reference
+ public StockQuoteService stockQuoteService;
+
+ public AccountServiceImpl() {
+ }
+
+ public AccountReportResponse getAccountReport(AccountReportRequest request) {
+ AccountReportResponse report = new AccountReportResponse();
+ String customerID = request.getCustomerID();
+ report.setAccountSummaries(new ArrayList<AccountSummary>());
+ report.getAccountSummaries().add(getCheckAccountSummary(customerID));
+ report.getAccountSummaries().add(getSavingsAccountSummary(customerID));
+ report.getAccountSummaries().add(getStockAccountSummary(customerID));
+ return report;
+ }
+
+ private AccountSummary getCheckAccountSummary(String customerID) {
+ CheckingAccount checking = accountDataService.getCheckingAccount(customerID);
+ AccountSummary summary = new AccountSummary();
+ summary.setAccountNumber(checking.getAccountNumber());
+ summary.setAccountType("Checking");
+ summary.setBalance(checking.getBalance());
+ return summary;
+ }
+
+ private AccountSummary getSavingsAccountSummary(String customerID) {
+ SavingsAccount savings = accountDataService.getSavingsAccount(customerID);
+ AccountSummary summary = new AccountSummary();
+ summary.setAccountNumber(savings.getAccountNumber());
+ summary.setAccountType("Savings");
+ summary.setBalance(savings.getBalance());
+ return summary;
+ }
+
+ private AccountSummary getStockAccountSummary(String customerID) {
+ StockAccount stock = accountDataService.getStockAccount(customerID);
+ AccountSummary summary = new AccountSummary();
+ summary.setAccountNumber(stock.getAccountNumber());
+ summary.setAccountType("Stock");
+ float quote = getQuote(stock.getSymbol());
+ summary.setBalance(quote * stock.getQuantity());
+ return summary;
+ }
+
+ private float getQuote(String symbol) {
+ StockQuoteRequest req = new StockQuoteRequest();
+ req.setSymbol(symbol);
+ StockQuoteResponse rep = stockQuoteService.getQuote(req);
+ return rep.getResult();
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java
new file mode 100644
index 0000000000..f6e5a060af
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.account;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "accountNumber", "accountType", "balance" })
+@XmlRootElement(name = "AccountSummary")
+public class AccountSummary {
+
+ @XmlElement(name = "AccountNumber")
+ private String accountNumber;
+
+ @XmlElement(name = "AccountType")
+ private String accountType;
+
+ @XmlElement(name = "Balance")
+ private float balance;
+
+ public AccountSummary() {
+ }
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public String getAccountType() {
+ return accountType;
+ }
+
+ public void setAccountType(String accountType) {
+ this.accountType = accountType;
+ }
+
+ public float getBalance() {
+ return balance;
+ }
+
+ public void setBalance(float balance) {
+ this.balance = balance;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataService.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..972b9dc704
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.accountdata;
+
+public interface AccountDataService {
+
+ CheckingAccount getCheckingAccount(String customerID);
+
+ SavingsAccount getSavingsAccount(String customerID);
+
+ StockAccount getStockAccount(String customerID);
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataServiceImpl.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..f9d0c08df7
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.accountdata;
+
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID + "_" + "CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID + "_" + "SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID + "_" + "STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/CheckingAccount.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/CheckingAccount.java
new file mode 100644
index 0000000000..596dcc8d06
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/CheckingAccount.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.accountdata;
+
+public class CheckingAccount {
+
+ private String accountNumber;
+ private float balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public float getBalance() {
+ return balance;
+ }
+
+ public void setBalance(float balance) {
+ this.balance = balance;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/SavingsAccount.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/SavingsAccount.java
new file mode 100644
index 0000000000..c208788ca8
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/SavingsAccount.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.accountdata;
+
+public class SavingsAccount {
+
+ private String accountNumber;
+ private float balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public float getBalance() {
+ return balance;
+ }
+
+ public void setBalance(float balance) {
+ this.balance = balance;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/StockAccount.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..1005bceb91
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/StockAccount.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.accountdata;
+
+public class StockAccount {
+
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteRequest.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteRequest.java
new file mode 100644
index 0000000000..4f12b18601
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteRequest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.stockquote;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "symbol" })
+@XmlRootElement(name = "StockQuoteRequest")
+public class StockQuoteRequest {
+
+ @XmlElement(name = "Symbol")
+ private String symbol;
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteResponse.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteResponse.java
new file mode 100644
index 0000000000..bf2d7c7c00
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteResponse.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.stockquote;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "result" })
+@XmlRootElement(name = "StockQuoteResponse")
+public class StockQuoteResponse {
+
+ @XmlElement(name = "Result")
+ private float result;
+
+ public float getResult() {
+ return result;
+ }
+
+ public void setResult(float result) {
+ this.result = result;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteService.java b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..3fa1558907
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.sca.bigbank.stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface StockQuoteService {
+
+ public StockQuoteResponse getQuote(StockQuoteRequest stockQuote);
+}
+
+
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j-tests.properties b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j-tests.properties
new file mode 100644
index 0000000000..bb7170437c
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j-tests.properties
@@ -0,0 +1,21 @@
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, out
+
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j.properties b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..18c99eb990
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/log4j.properties
@@ -0,0 +1,21 @@
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, stdout
+
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/account/AccountService.wsdl b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/account/AccountService.wsdl
new file mode 100644
index 0000000000..9797a5739c
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/account/AccountService.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://sca.servicemix.apache.org/Bigbank/Account"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://sca.servicemix.apache.org/Bigbank/Account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://sca.servicemix.apache.org/Bigbank/Account" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReportRequest" type="tns:AccountReportRequest"/>
+ <xsd:complexType name="AccountReportRequest">
+ <xsd:sequence>
+ <xsd:element name="CustomerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getAccountReportResponse" type="tns:AccountReportResponse"/>
+
+ <xsd:complexType name="AccountReportResponse">
+ <xsd:sequence>
+ <xsd:element name="AccountSummaries">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="AccountSummary"
+ type="tns:AccountSummary" maxOccurs="unbounded" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:sequence>
+ <xsd:element name="AccountNumber" type="xsd:string"/>
+ <xsd:element name="AccountType" type="xsd:string"/>
+ <xsd:element name="Balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReportRequest" name="getAccountReportRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceJBI" type="tns:AccountService">
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceJBI"
+ name="AccountServiceJBI">
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/sca.module b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/sca.module
new file mode 100644
index 0000000000..ae520dd54e
--- /dev/null
+++ b/sandbox/old/contrib/binding-servicemix/binding/src/test/resources/org/apache/servicemix/sca/bigbank/sca.module
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+
+ name="org.apache.servicemix.sca.bigbank">
+
+ <entryPoint name="AccountService">
+ <interface.java interface="org.apache.servicemix.sca.bigbank.account.AccountService"/>
+ <interface.wsdl interface="http://sca.servicemix.apache.org/Bigbank/Account#AccountService"/>
+ <binding.jbi port="http://sca.servicemix.apache.org/Bigbank/Account/AccountService/AccountServiceJBI"/>
+ <reference>AccountServiceComponent</reference>
+ </entryPoint>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="org.apache.servicemix.sca.bigbank.account.AccountServiceImpl"/>
+ <properties>
+ <v:currency>EURO</v:currency>
+ </properties>
+ <references>
+ <v:accountDataService>AccountDataServiceComponent</v:accountDataService>
+ <v:stockQuoteService>StockQuoteService</v:stockQuoteService>
+ </references>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="org.apache.servicemix.sca.bigbank.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+ <externalService name="StockQuoteService">
+ <interface.java interface="org.apache.servicemix.sca.bigbank.stockquote.StockQuoteService"/>
+ <binding.jbi port="http://www.quickstockquote.com/StockQuoteService/StockQuoteServiceJBI"/>
+ </externalService>
+
+ <import.wsdl
+ location="org/apache/servicemix/sca/bigbank/account/AccountService.wsdl"
+ namespace="http://sca.servicemix.apache.org/Bigbank/Account" />
+
+</module>
+
diff --git a/sandbox/old/contrib/databinding-castor/.ruleset b/sandbox/old/contrib/databinding-castor/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/databinding-castor/LICENSE.txt b/sandbox/old/contrib/databinding-castor/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/databinding-castor/NOTICE.txt b/sandbox/old/contrib/databinding-castor/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/databinding-castor/pom.xml.off b/sandbox/old/contrib/databinding-castor/pom.xml.off
new file mode 100755
index 0000000000..728eb68790
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/pom.xml.off
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-castor</artifactId>
+ <name>Apache Tuscany Data Binding for Castor</name>
+ <description>Tuscany Castor Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-framework</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.castor</groupId>
+ <artifactId>castor</artifactId>
+ <version>1.1</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>2.0.8</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/castor-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.castor</groupId>
+ <artifactId>castor-codegen-anttask</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-castor</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask"
+ classpathref="maven.test.classpath" />
+ <mkdir dir="${project.build.directory}/castor-source"></mkdir>
+ <castor-srcgen file="${basedir}/src/test/resources/ipo.xsd"
+ todir="${project.build.directory}/castor-source" package="com.example.ipo.castor" types="j2"
+ warnings="false"
+ properties="${basedir}/src/test/resources/org/exolab/castor/builder/castorbuilder.properties"
+ bindingfile="${basedir}/src/test/resources/binding.xml" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Node.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Node.java
new file mode 100755
index 0000000000..9ae0335ada
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Node.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Marshaller;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+public class Castor2Node<T> extends TransformerExtension<T, Node> implements PullTransformer<T, Node> {
+ private Class<T> type;
+
+ public Castor2Node(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public Class getSourceType() {
+ return type;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public Node transform(Object source, TransformationContext context) {
+ try {
+ Document document = DOMHelper.newDocument();
+ Marshaller.marshal(source, document);
+ return document;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2SAX.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2SAX.java
new file mode 100644
index 0000000000..643d6fb4ad
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2SAX.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import java.io.Writer;
+
+import org.apache.tuscany.spi.databinding.PushTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Marshaller;
+
+public class Castor2SAX<T> extends TransformerExtension<T, Writer> implements PushTransformer<T, Writer> {
+ private Class<T> type;
+
+ /**
+ * @param type
+ */
+ public Castor2SAX(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getSourceType() {
+ return type;
+ }
+
+ public Class getTargetType() {
+ return Writer.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public void transform(T source, Writer writer, TransformationContext context) {
+ try {
+ Marshaller.marshal(source, writer);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Writer.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Writer.java
new file mode 100644
index 0000000000..f477273387
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Castor2Writer.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import org.apache.tuscany.spi.databinding.PushTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Marshaller;
+import org.xml.sax.ContentHandler;
+
+public class Castor2Writer<T> extends TransformerExtension<T, ContentHandler> implements PushTransformer<T, ContentHandler> {
+ private Class<T> type;
+
+ /**
+ * @param type
+ */
+ public Castor2Writer(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getSourceType() {
+ return type;
+ }
+
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public void transform(T source, ContentHandler contentHandler, TransformationContext context) {
+ try {
+ Marshaller.marshal(source, contentHandler);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/InputSource2Castor.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/InputSource2Castor.java
new file mode 100644
index 0000000000..61bac7d20f
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/InputSource2Castor.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Unmarshaller;
+import org.xml.sax.InputSource;
+
+public class InputSource2Castor<T> extends TransformerExtension<InputSource, T> implements PullTransformer<InputSource, T> {
+ private Class<T> type;
+
+ /**
+ * @param type
+ */
+ public InputSource2Castor(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getTargetType() {
+ return type;
+ }
+
+ public Class getSourceType() {
+ return InputSource.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public T transform(InputSource source, TransformationContext context) {
+ try {
+ Object object = Unmarshaller.unmarshal(type, source);
+ return type.cast(object);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Node2Castor.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Node2Castor.java
new file mode 100644
index 0000000000..fa5a15b3ba
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Node2Castor.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Unmarshaller;
+import org.w3c.dom.Node;
+
+public class Node2Castor<T> extends TransformerExtension<Node, T> implements PullTransformer<Node, T> {
+ private Class<T> type;
+
+ /**
+ * @param type
+ */
+ public Node2Castor(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getTargetType() {
+ return type;
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public T transform(Node source, TransformationContext context) {
+ try {
+ Object object = Unmarshaller.unmarshal(type, source);
+ return type.cast(object);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Reader2Castor.java b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Reader2Castor.java
new file mode 100644
index 0000000000..a8ade1bda5
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/main/java/org/apache/tuscany/databinding/castor/Reader2Castor.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import java.io.Reader;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.exolab.castor.xml.Unmarshaller;
+
+public class Reader2Castor<T> extends TransformerExtension<Reader, T> implements PullTransformer<Reader, T> {
+ private Class<T> type;
+
+ /**
+ * @param type
+ */
+ public Reader2Castor(Class<T> type) {
+ super();
+ this.type = type;
+ }
+
+ public Class getTargetType() {
+ return type;
+ }
+
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PullTransformer#transform(java.lang.Object, org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public T transform(Reader source, TransformationContext context) {
+ try {
+ Object object = Unmarshaller.unmarshal(type, source);
+ return type.cast(object);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/test/java/org/apache/tuscany/databinding/castor/Castor2NodeTestCase.java b/sandbox/old/contrib/databinding-castor/src/test/java/org/apache/tuscany/databinding/castor/Castor2NodeTestCase.java
new file mode 100644
index 0000000000..3ea86321e7
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/test/java/org/apache/tuscany/databinding/castor/Castor2NodeTestCase.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.castor;
+
+import java.io.StringReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.w3c.dom.Node;
+
+import com.example.ipo.castor.PurchaseOrderType;
+
+public class Castor2NodeTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ public void testTransform() throws Exception {
+ Reader2Castor<PurchaseOrderType> t1 = new Reader2Castor<PurchaseOrderType>(PurchaseOrderType.class);
+ PurchaseOrderType po = t1.transform(new StringReader(IPO_XML), null);
+ Castor2Node t2 = new Castor2Node(PurchaseOrderType.class);
+ Node node = t2.transform(po, null);
+ Assert.assertNotNull(node);
+
+ }
+}
diff --git a/sandbox/old/contrib/databinding-castor/src/test/resources/binding.xml b/sandbox/old/contrib/databinding-castor/src/test/resources/binding.xml
new file mode 100755
index 0000000000..9b66de4cca
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/test/resources/binding.xml
@@ -0,0 +1,9 @@
+<binding xmlns="http://www.castor.org/SourceGenerator/Binding"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ defaultBinding="type">
+
+ <elementBinding name="complexType:PurchaseOrderType/items">
+ <java-class name="ItemsElement"/>
+ </elementBinding>
+
+</binding>
diff --git a/sandbox/old/contrib/databinding-castor/src/test/resources/ipo.xsd b/sandbox/old/contrib/databinding-castor/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sandbox/old/contrib/databinding-castor/src/test/resources/org/exolab/castor/builder/castorbuilder.properties b/sandbox/old/contrib/databinding-castor/src/test/resources/org/exolab/castor/builder/castorbuilder.properties
new file mode 100644
index 0000000000..d6f593fd00
--- /dev/null
+++ b/sandbox/old/contrib/databinding-castor/src/test/resources/org/exolab/castor/builder/castorbuilder.properties
@@ -0,0 +1,67 @@
+#
+# Property file for SourceCodeGenerator
+#
+# $Id: castorbuilder.properties,v 1.3 2004/05/06 08:20:51 kvisco Exp $
+
+# To enable bound properties uncomment the following line. Please
+# note that currently *all* fields will be treated as bound properties
+# when enabled. This will change in the future when we introduce
+# fine grained control over each class and it's properties.
+#
+#org.exolab.castor.builder.boundproperties=true
+
+# Java class mapping of <xsd:element>'s and <xsd:complexType>'s
+#
+# FIXME: There's a bug in the castor-generated code which cannot handle subutype correctly
+# http://jira.codehaus.org/browse/CASTOR-1475
+org.exolab.castor.builder.javaclassmapping=type
+org.exolab.castor.builder.javaVersion=5.0
+
+
+# This property allows one to specify the super class of *all*
+# generated classes
+#
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+#org.exolab.castor.builder.nspackages=\
+ http://www.xyz.com/schemas/project=com.xyz.schemas.project,\
+ http://www.xyz.com/schemas/person=com.xyz.schemas.person
+
+# Set to true if you want to generate the equals method
+# for each generated class
+# false by default
+#
+#org.exolab.castor.builder.equalsmethod=true
+
+# Set to true if you want to use Object Wrappers instead
+# of primitives (e.g Float instead of float).
+# false by default.
+#
+#org.exolab.castor.builder.primitivetowrapper=false
+
+# Set to true if you want the generated class descriptors to
+# expose the element and attribute names they contain.
+# false by default.
+#
+#org.exolab.castor.builder.classdescfieldnames=false
+
+# Set to true if you want the generated source code to contain
+# Extra methods for the collection fields, such as get/set using
+# the collection type in addition to the type-safe array.
+# Set this to true if you want your code to be more compatible
+# with Castor JDO. This is false by default.
+#
+#org.exolab.castor.builder.extraCollectionMethods=true
+
+# Use old-style (Castor 0.9.3.9) of naming that uppercases
+# names after an underscore
+#
+#org.exolab.castor.xml.JavaNaming.upperCaseAfterUnderscore=true
+
+# This property specifies whether generated enumerated type
+# classes implement the EnumeratedTypeAccess interface.
+# false by default
+#org.exolab.castor.builder.enumTypeAccessInterface=true
+
diff --git a/sandbox/old/contrib/databinding-json/.ruleset b/sandbox/old/contrib/databinding-json/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/databinding-json/LICENSE.txt b/sandbox/old/contrib/databinding-json/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/databinding-json/NOTICE.txt b/sandbox/old/contrib/databinding-json/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/databinding-json/pom.xml.off b/sandbox/old/contrib/databinding-json/pom.xml.off
new file mode 100644
index 0000000000..9d9903538a
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/pom.xml.off
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-json</artifactId>
+ <name>Apache Tuscany Data Binding for JSON</name>
+ <description>Tuscany JSON Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-framework</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0-beta-1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java
new file mode 100644
index 0000000000..e48e8dbf27
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class JSON2XMLStreamReader extends TransformerExtension<JSONObject, XMLStreamReader> implements
+ PullTransformer<JSONObject, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return JSONObject.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(JSONObject source, TransformationContext context) {
+ try {
+ return new BadgerFishXMLStreamReader(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java
new file mode 100644
index 0000000000..2cc8c1da37
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.json.JSONObject;
+
+/**
+ * JAXB DataBinding
+ */
+public class JSONDataBinding extends DataBindingExtension {
+ public static final String NAME = JSONObject.class.getName();
+ public static final String[] ALIASES = new String[] {"json"};
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/json/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public JSONDataBinding() {
+ super(NAME, ALIASES, JSONObject.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg) {
+ try {
+ JSONObject src = (JSONObject)arg;
+ return new JSONObject(src.toString());
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java
new file mode 100644
index 0000000000..872fe1cff3
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class XMLStreamReader2JSON extends TransformerExtension<XMLStreamReader, JSONObject> implements
+ PullTransformer<XMLStreamReader, JSONObject> {
+
+ @Override
+ protected Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return JSONObject.class;
+ }
+
+ public JSONObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(source, jsonWriter);
+ return new JSONObject(writer.toString());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java
new file mode 100644
index 0000000000..74c39cba0f
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java
@@ -0,0 +1,272 @@
+package org.apache.tuscany.databinding.json;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * The XMLStreamSerializer pulls events from the XMLStreamReader and dumps into the XMLStreamWriter
+ */
+public class XMLStreamSerializer implements XMLStreamConstants {
+ public static final String NAMESPACE_PREFIX = "ns";
+ private static int namespaceSuffix;
+
+ /*
+ * The behavior of the serializer is such that it returns when it encounters the starting element for the second
+ * time. The depth variable tracks the depth of the serilizer and tells it when to return. Note that it is assumed
+ * that this serialization starts on an Element.
+ */
+
+ /**
+ * Field depth
+ */
+ private int depth;
+
+ /**
+ * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
+ *
+ * @param nsCtxt
+ * @return string
+ */
+ private String generateUniquePrefix(NamespaceContext nsCtxt) {
+ String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ // null should be returned if the prefix is not bound!
+ while (nsCtxt.getNamespaceURI(prefix) != null) {
+ prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Method serialize.
+ *
+ * @param node
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void serialize(XMLStreamReader node, XMLStreamWriter writer) throws XMLStreamException {
+ serializeNode(node, writer);
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeAttributes(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ int count = reader.getAttributeCount();
+ String prefix;
+ String namespaceName;
+ String writerPrefix;
+ for (int i = 0; i < count; i++) {
+ prefix = reader.getAttributePrefix(i);
+ namespaceName = reader.getAttributeNamespace(i);
+ /*
+ * Due to parser implementations returning null as the namespace URI (for the empty namespace) we need to
+ * make sure that we deal with a namespace name that is not null. The best way to work around this issue is
+ * to set the namespace uri to "" if it is null
+ */
+ if (namespaceName == null) {
+ namespaceName = "";
+ }
+
+ writerPrefix = writer.getNamespaceContext().getPrefix(namespaceName);
+
+ if (!"".equals(namespaceName)) {
+ // prefix has already being declared but this particular
+ // attrib has a
+ // no prefix attached. So use the prefix provided by the
+ // writer
+ if (writerPrefix != null && (prefix == null || prefix.equals(""))) {
+ writer.writeAttribute(writerPrefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // writer prefix is available but different from the
+ // current
+ // prefix of the attrib. We should be decalring the new
+ // prefix
+ // as a namespace declaration
+ } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) {
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // prefix is null (or empty), but the namespace name is
+ // valid! it has not
+ // being written previously also. So we need to generate
+ // a prefix
+ // here
+ } else if (prefix == null || prefix.equals("")) {
+ prefix = generateUniquePrefix(writer.getNamespaceContext());
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ } else {
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ }
+ } else {
+ // empty namespace is equal to no namespace!
+ writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i));
+ }
+
+ }
+ }
+
+ /**
+ * Method serializeCData.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeCData(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCData(reader.getText());
+ }
+
+ /**
+ * Method serializeComment.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeComment(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeComment(reader.getText());
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeElement(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix = reader.getPrefix();
+ String nameSpaceName = reader.getNamespaceURI();
+ if (nameSpaceName != null) {
+ String writerPrefix = writer.getPrefix(nameSpaceName);
+ if (writerPrefix != null) {
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ } else {
+ if (prefix != null) {
+ writer.writeStartElement(prefix, reader.getLocalName(), nameSpaceName);
+ writer.writeNamespace(prefix, nameSpaceName);
+ writer.setPrefix(prefix, nameSpaceName);
+ } else {
+ // [rfeng] We need to set default NS 1st before calling writeStateElement
+ writer.setDefaultNamespace(nameSpaceName);
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ writer.writeDefaultNamespace(nameSpaceName);
+ }
+ }
+ } else {
+ writer.writeStartElement(reader.getLocalName());
+ }
+
+ // add the namespaces
+ int count = reader.getNamespaceCount();
+ String namespacePrefix;
+ for (int i = 0; i < count; i++) {
+ namespacePrefix = reader.getNamespacePrefix(i);
+ // [rfeng] The following is commented out to allow to default ns
+ // if (namespacePrefix != null && namespacePrefix.length() == 0) {
+ // continue;
+ // }
+
+ serializeNamespace(namespacePrefix, reader.getNamespaceURI(i), writer);
+ }
+
+ // add attributes
+ serializeAttributes(reader, writer);
+
+ }
+
+ /**
+ * Method serializeEndElement.
+ *
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeEndElement(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ /**
+ * Method serializeNamespace.
+ *
+ * @param prefix
+ * @param uri
+ * @param writer
+ * @throws XMLStreamException
+ */
+ private void serializeNamespace(String prefix, String uri, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix1 = writer.getPrefix(uri);
+ if (prefix1 == null) {
+ writer.writeNamespace(prefix, uri);
+ writer.setPrefix(prefix, uri);
+ }
+ }
+
+ /**
+ * Method serializeNode.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ // TODO We get the StAXWriter at this point and uses it hereafter
+ // assuming that this is the only entry point
+ // to this class.
+ // If there can be other classes calling methodes of this we might
+ // need to change methode signatures to
+ // OMOutputer
+ while (true) {
+ int event = reader.getEventType();
+ if (event == START_ELEMENT) {
+ serializeElement(reader, writer);
+ depth++;
+ } else if (event == ATTRIBUTE) {
+ serializeAttributes(reader, writer);
+ } else if (event == CHARACTERS) {
+ serializeText(reader, writer);
+ } else if (event == COMMENT) {
+ serializeComment(reader, writer);
+ } else if (event == CDATA) {
+ serializeCData(reader, writer);
+ } else if (event == END_ELEMENT) {
+ serializeEndElement(writer);
+ depth--;
+ } else if (event == START_DOCUMENT) {
+ depth++; // if a start document is found then increment
+ writer.writeStartDocument();
+ // the depth
+ } else if (event == END_DOCUMENT) {
+ if (depth != 0) {
+ depth--; // for the end document - reduce the depth
+ }
+ writer.writeEndDocument();
+ }
+ if (depth == 0) {
+ break;
+ }
+ if (reader.hasNext()) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCharacters(reader.getText());
+ }
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java
new file mode 100644
index 0000000000..2856873d7c
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json.axiom;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.databinding.json.JSONDataBinding;
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.XMLType;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class JSON2OMElement extends TransformerExtension<JSONObject, OMElement> implements
+ PullTransformer<JSONObject, OMElement> {
+
+ private OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ @Override
+ protected Class getSourceType() {
+ return JSONObject.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public OMElement transform(JSONObject source, TransformationContext context) {
+ try {
+ String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
+ String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
+ if (context != null) {
+ DataType<?> dataType = context.getTargetDataType();
+ Object logical = dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement()) {
+ ns = xmlType.getElementName().getNamespaceURI();
+ name = xmlType.getElementName().getLocalPart();
+ }
+ }
+ }
+ JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(source);
+ OMNamespace namespace = factory.createOMNamespace(ns, "");
+ return factory.createOMElement(ds, name, namespace);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java
new file mode 100644
index 0000000000..22476b10af
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json.axiom;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Badgerfish" JSON convention.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class JSONBadgerfishDataSource extends JSONDataSource {
+
+ public JSONBadgerfishDataSource(JSONObject json) {
+ super(json);
+ }
+
+ /**
+ * Gives the StAX reader using the "Badgerfish" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+ public javax.xml.stream.XMLStreamReader getReader() throws XMLStreamException {
+ try {
+ return new BadgerFishXMLStreamReader(json);
+ } catch (JSONException e) {
+ throw new XMLStreamException(e);
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java
new file mode 100644
index 0000000000..744c5a407e
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json.axiom;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMOutputFormat;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Mapped" JSON convention.
+ */
+
+public class JSONDataSource implements OMDataSource {
+ protected JSONObject json;
+
+ public JSONDataSource(JSONObject json) {
+ this.json = json;
+ }
+
+ /**
+ * Writes JSON into the output stream. As this should write JSON, it directly gets the JSON string and writes it
+ * without expanding the tree.
+ *
+ * @param outputStream the stream to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message in to the output
+ * stream.
+ */
+ public void serialize(OutputStream outputStream, OMOutputFormat omOutputFormat)
+ throws javax.xml.stream.XMLStreamException {
+ try {
+ String encoding = omOutputFormat == null ? "UTF-8" : omOutputFormat.getCharSetEncoding();
+ outputStream.write(getJSONString().getBytes(encoding));
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes JSON through the writer. As this should write JSON, it directly gets the JSON string and writes it without
+ * expanding the tree.
+ *
+ * @param writer Writer to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the writer.
+ */
+ public void serialize(Writer writer, OMOutputFormat omOutputFormat) throws javax.xml.stream.XMLStreamException {
+ try {
+ writer.write(getJSONString());
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes XML through the XMLStreamWriter. As the input data source is JSON, this method needs to get a StAX reader
+ * from that JSON String. Therefore this uses the getReader() method to get the StAX reader writes the events into
+ * the XMLStreamWriter.
+ *
+ * @param xmlStreamWriter StAX writer to be written into
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the StAX
+ * writer.
+ */
+ public void serialize(javax.xml.stream.XMLStreamWriter xmlStreamWriter) throws javax.xml.stream.XMLStreamException {
+ XMLStreamReader reader = getReader();
+ xmlStreamWriter.writeStartDocument();
+ while (reader.hasNext()) {
+ int x = reader.next();
+ switch (x) {
+ case XMLStreamConstants.START_ELEMENT:
+ xmlStreamWriter.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader
+ .getNamespaceURI());
+ int namespaceCount = reader.getNamespaceCount();
+ for (int i = namespaceCount - 1; i >= 0; i--) {
+ xmlStreamWriter.writeNamespace(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
+ }
+ int attributeCount = reader.getAttributeCount();
+ for (int i = 0; i < attributeCount; i++) {
+ xmlStreamWriter.writeAttribute(reader.getAttributePrefix(i),
+ reader.getAttributeNamespace(i),
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
+ }
+ break;
+ case XMLStreamConstants.START_DOCUMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ xmlStreamWriter.writeCharacters(reader.getText());
+ break;
+ case XMLStreamConstants.CDATA:
+ xmlStreamWriter.writeCData(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ xmlStreamWriter.writeEndElement();
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ xmlStreamWriter.writeEndDocument();
+ break;
+ case XMLStreamConstants.SPACE:
+ break;
+ case XMLStreamConstants.COMMENT:
+ xmlStreamWriter.writeComment(reader.getText());
+ break;
+ case XMLStreamConstants.DTD:
+ xmlStreamWriter.writeDTD(reader.getText());
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ xmlStreamWriter.writeProcessingInstruction(reader.getPITarget(), reader.getPIData());
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ xmlStreamWriter.writeEntityRef(reader.getLocalName());
+ break;
+ default:
+ throw new OMException();
+ }
+ }
+ xmlStreamWriter.writeEndDocument();
+ }
+
+ /**
+ * Gives the StAX reader using the "Mapped" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+
+ public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException {
+
+ Map<String, String> nsMap = new HashMap<String, String>();
+ nsMap.put("", "");
+
+ // input factory for "Mapped" convention
+ MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
+ String jsonString = this.getJSONString();
+ return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
+ }
+
+ // returns the json string by consuming the JSON input stream.
+ protected String getJSONString() {
+ return json.toString();
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl
new file mode 100644
index 0000000000..42a110ec3f
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.databinding.json.include" autowire="true">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..fa2c17c5f9
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.json" autowire="true">
+ <include name="org.apache.tuscany.databinding.json.include" scdlLocation="databinding.json.scdl" />
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/extension.composite b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..fa2c17c5f9
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.json" autowire="true">
+ <include name="org.apache.tuscany.databinding.json.include" scdlLocation="databinding.json.scdl" />
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java b/sandbox/old/contrib/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java
new file mode 100644
index 0000000000..7fea86ef6a
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java
@@ -0,0 +1,88 @@
+package org.apache.tuscany.databinding.json;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.databinding.json.axiom.JSON2OMElement;
+import org.json.JSONObject;
+
+public class JSONTransformerTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private static final String JSON_STR =
+ "{\"xsl:root\":{\"@xmlns\":{\"xsl\":\"http://foo.com\"},\"data\":{\"$\":\"my json string\"}}}";
+
+ public void testXML2JSON() throws Exception {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2JSON t1 = new XMLStreamReader2JSON();
+ JSONObject json = t1.transform(reader, null);
+ Assert.assertNotNull(json);
+
+ // Cannot round-trip as we hit a bug in Jettison
+ /*
+ JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
+ XMLStreamReader reader2 = t2.transform(json, null);
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ new XMLStreamSerializer().serialize(reader2, streamWriter);
+ streamWriter.flush();
+ System.out.println(sw.toString());
+ */
+
+ }
+
+ public void testJSON2XML() throws Exception {
+ JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
+ XMLStreamReader reader2 = t2.transform(new JSONObject(JSON_STR), null);
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ new XMLStreamSerializer().serialize(reader2, streamWriter);
+ streamWriter.flush();
+ Assert.assertTrue(sw.toString().contains("<xsl:root xmlns:xsl=\"http://foo.com\"><data>my json string</data></xsl:root>"));
+ }
+
+ public void testJSON2OMElement() throws Exception {
+ JSON2OMElement t1 = new JSON2OMElement();
+ OMElement element = t1.transform(new JSONObject(JSON_STR), null);
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ System.out.println(writer.toString());
+ }
+}
diff --git a/sandbox/old/contrib/databinding-json/src/test/resources/ipo.xsd b/sandbox/old/contrib/databinding-json/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5468542693
--- /dev/null
+++ b/sandbox/old/contrib/databinding-json/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sandbox/old/contrib/databinding-xmlbeans/.ruleset b/sandbox/old/contrib/databinding-xmlbeans/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/databinding-xmlbeans/LICENSE.txt b/sandbox/old/contrib/databinding-xmlbeans/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/databinding-xmlbeans/NOTICE.txt b/sandbox/old/contrib/databinding-xmlbeans/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/databinding-xmlbeans/pom.xml.off b/sandbox/old/contrib/databinding-xmlbeans/pom.xml.off
new file mode 100755
index 0000000000..f386b82df2
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/pom.xml.off
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-xmlbeans</artifactId>
+ <name>Apache Tuscany Data Binding for XmlBeans</name>
+ <description>Tuscany XmlBeans Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-framework</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/xmlbeans-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-xmlbeans</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
+ classpathref="maven.compile.classpath" />
+ <xmlbean schema="${basedir}/src/test/resources" classpathref="maven.compile.classpath"
+ destfile="${project.build.directory}/ipo-xmlbeans.jar"
+ srcgendir="${project.build.directory}/xmlbeans-source" javasource="1.5"
+ classgendir="${project.build.directory}/test-classes" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java
new file mode 100755
index 0000000000..0b4da53473
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class Node2XmlObject extends TransformerExtension<Node, XmlObject> implements
+ PullTransformer<Node, XmlObject> {
+ // private XmlOptions options;
+
+ public XmlObject transform(Node source, TransformationContext context) {
+ try {
+ return XmlObject.Factory.parse(source);
+ } catch (XmlException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java
new file mode 100644
index 0000000000..12057982e4
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.xmlbeans;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * XMLBeans DataBinding
+ */
+public class XMLBeansDataBinding extends DataBindingExtension {
+ public static final String NAME = XmlObject.class.getName();
+
+ public XMLBeansDataBinding() {
+ super(NAME, XmlObject.class);
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java
new file mode 100755
index 0000000000..0e61bd9571
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+
+@Service(Transformer.class)
+public class XMLStreamReader2XmlObject extends TransformerExtension<XMLStreamReader, XmlObject> implements PullTransformer<XMLStreamReader, XmlObject> {
+ // private XmlOptions options;
+
+ public XmlObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ return XmlObject.Factory.parse(source);
+ } catch (XmlException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java
new file mode 100755
index 0000000000..8fc1e58bd5
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class XmlObject2Node extends TransformerExtension<XmlObject, Node> implements
+ PullTransformer<XmlObject, Node> {
+ // private XmlOptions options;
+
+ public Node transform(XmlObject source, TransformationContext context) {
+ if (source == null)
+ return null;
+ return source.newDomNode();
+ }
+
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java
new file mode 100755
index 0000000000..8a12cf34f0
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.apache.xmlbeans.XmlObject;
+
+public class XmlObject2XMLStreamReader extends TransformerExtension<XmlObject, XMLStreamReader> implements PullTransformer<XmlObject, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public XMLStreamReader transform(XmlObject source, TransformationContext context) {
+ return source.newXMLStreamReader();
+ }
+
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl
new file mode 100644
index 0000000000..753d1fdf18
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.databinding.xmlbeans.include" autowire="true">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..313187a501
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.xmlbeans" autowire="true">
+ <include name="org.apache.tuscany.databinding.xmlbeans.include" scdlLocation="databinding.xmlbeans.scdl" />
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..a7de4cfd94
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.xmlbeans" autowire="true">
+ <include name="org.apache.tuscany.databinding.xmlbeans.include" scdlLocation="databinding.xmlbeans.scdl" />
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java b/sandbox/old/contrib/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java
new file mode 100755
index 0000000000..57fbae7e35
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+import com.example.ipo.xmlbeans.PurchaseOrderDocument;
+
+public class XmlObjectTestCase extends TestCase {
+ private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + " <name>Helen Zoe</name>" + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>" + " <postcode>CB1 1JR</postcode>" + " </shipTo>" + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>" + " <street>8 Oak Avenue</street>" + " <city>Old Town</city>" + " <state>PA</state>"
+ + " <zip>95819</zip>" + " </billTo>" + " <items>" + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>" + " <quantity>1</quantity>" + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>" + " <shipDate>1999-12-05</shipDate>" + " </item>" + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testXmlObject() throws Exception {
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ XmlObject object2 = t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ public void testGeneratedXmlObject() throws Exception {
+ // URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ PurchaseOrderDocument object = PurchaseOrderDocument.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ PurchaseOrderDocument object2 = (PurchaseOrderDocument) t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ PurchaseOrderDocument object3 = (PurchaseOrderDocument) t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsd b/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsdconfig b/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
new file mode 100755
index 0000000000..a397182672
--- /dev/null
+++ b/sandbox/old/contrib/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
@@ -0,0 +1,21 @@
+<!-- Copyright 2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <xb:namespace uri="http://www.example.com/IPO">
+ <xb:package>com.example.ipo.xmlbeans</xb:package>
+ </xb:namespace>
+
+</xb:config>
diff --git a/sandbox/old/contrib/discovery-jms/DISCLAIMER b/sandbox/old/contrib/discovery-jms/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/old/contrib/discovery-jms/LICENSE b/sandbox/old/contrib/discovery-jms/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/LICENSE
@@ -0,0 +1,205 @@
+
+ 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.
+
+
+
diff --git a/sandbox/old/contrib/discovery-jms/NOTICE b/sandbox/old/contrib/discovery-jms/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/discovery-jms/pom.xml b/sandbox/old/contrib/discovery-jms/pom.xml
new file mode 100644
index 0000000000..1f64ac3c29
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.discovery</groupId>
+ <artifactId>tuscany-jms-discovery</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JMS Discovery</name>
+ <description>Apache Tuscany JMS Discovery</description>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.0-incubator</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/JmsDiscoveryService.java b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/JmsDiscoveryService.java
new file mode 100644
index 0000000000..518d482245
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/JmsDiscoveryService.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jms;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.tuscany.spi.services.discovery.AbstractDiscoveryService;
+import org.apache.tuscany.spi.services.discovery.DiscoveryException;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * JMS based implementation of the discovery service. This class uses
+ * ActiveMQ specific API instead of JNDI based administered objects. This can
+ * be changed later if required.
+ *
+ * @version $Revision$ $Date$
+ */
+public class JmsDiscoveryService extends AbstractDiscoveryService {
+
+ // Connection factory
+ private ConnectionFactory connectionFactory;
+
+ // Underlying JMS connection
+ private Connection connection;
+
+ // Session used for reception
+ private Session receiverSession;
+
+ // Message consumer
+ private MessageConsumer messageConsumer;
+
+ // Topic to use
+ private Topic topic;
+
+ // String broker url
+ private String brokerUrl = ActiveMQConnection.DEFAULT_BROKER_URL;
+
+ /**
+ * Injects the topic used for communication.
+ * @param topic Topic used for communication.
+ */
+ @Property
+ public void setTopic(String topic) {
+ this.topic = new ActiveMQTopic(topic);
+ }
+
+ /**
+ * Injects the broker URL.
+ * @param brokerUrl Broker URL to use.
+ */
+ @Property
+ public void setBrokerUrl(String brokerUrl) {
+ this.brokerUrl = brokerUrl;
+ }
+
+ /**
+ * Starts the service and sets up the message listener.
+ */
+ @Override
+ protected synchronized void onStart() throws DiscoveryException {
+
+ String runtimeId = getRuntimeInfo().getRuntimeId();
+
+ try {
+
+ connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
+
+ connection = connectionFactory.createConnection();
+ connection.setExceptionListener(new ExceptionListener() {
+ public void onException(JMSException jmsException) {
+ // Try restarting: TODO this may need further refinement
+ try {
+ onStop();
+ } catch (DiscoveryException ex) {
+ ex.printStackTrace();
+ }
+ try {
+ onStart();
+ } catch (DiscoveryException ex) {
+ ex.printStackTrace();
+ }
+ }
+ });
+ receiverSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+
+ messageConsumer = receiverSession.createConsumer(topic);
+ final MessageListener messageListener = new TuscanyMessageListener(this, runtimeId);
+ messageConsumer.setMessageListener(messageListener);
+ connection.start();
+
+ } catch (JMSException ex) {
+ throw new DiscoveryException(ex);
+ }
+
+ }
+
+ /**
+ * Closes the connection.
+ */
+ @Override
+ protected synchronized void onStop() throws DiscoveryException {
+
+ try {
+ receiverSession.close();
+ } catch (JMSException ex) {
+ throw new DiscoveryException(ex);
+ } finally {
+ try {
+ connection.close();
+ } catch (JMSException ex) {
+ throw new DiscoveryException(ex);
+ }
+ }
+
+ }
+
+ /**
+ * Sends the message.
+ */
+ public synchronized int sendMessage(String runtimeId, XMLStreamReader reader) throws DiscoveryException {
+
+ try {
+
+ String text = StaxUtil.serialize(reader);
+ Session senderSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer messageProducer = senderSession.createProducer(topic);
+
+ TextMessage textMessage = senderSession.createTextMessage(text);
+
+ textMessage.setStringProperty("runtimeId", runtimeId);
+ messageProducer.send(textMessage);
+ senderSession.commit();
+ senderSession.close();
+
+ return 1;
+
+ } catch (XMLStreamException ex) {
+ throw new DiscoveryException(ex);
+ } catch (JMSException ex) {
+ throw new DiscoveryException(ex);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyJmsException.java b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyJmsException.java
new file mode 100644
index 0000000000..6b5f4066bf
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyJmsException.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jms;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("serial")
+public class TuscanyJmsException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the cause.
+ * @param th Root cause for the exception.
+ */
+ public TuscanyJmsException(Throwable th) {
+ super(th);
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyMessageListener.java b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyMessageListener.java
new file mode 100644
index 0000000000..e34e1f6199
--- /dev/null
+++ b/sandbox/old/contrib/discovery-jms/src/main/java/org/apache/tuscany/service/discovery/jms/TuscanyMessageListener.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jms;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+
+/**
+ * Tuscany JMS message listsner.
+ *
+ * @version $Revision$ $Date$
+ */
+public class TuscanyMessageListener implements MessageListener {
+
+ // Discovery service
+ private JmsDiscoveryService discoveryService;
+
+ // Runtime id
+ private String runtimeId;
+
+ /**
+ * Initializes the discovery service.
+ * @param discoveryService Discovery service.
+ */
+ public TuscanyMessageListener(JmsDiscoveryService discoveryService, String runtimeId) {
+ this.discoveryService = discoveryService;
+ this.runtimeId = runtimeId;
+ }
+
+ /**
+ * Message listener callback.
+ */
+ public void onMessage(Message message) {
+
+ try {
+
+ // TODO investigate why selectors are not working
+ if(!runtimeId.equals(message.getStringProperty("runtimeId"))) {
+ return;
+ }
+
+ final TextMessage textMessage = (TextMessage)message;
+ final String text = textMessage.getText();
+
+ final QName messageType = StaxUtil.getDocumentElementQName(text);
+ System.err.println("Message received: " + messageType);
+
+ RequestListener messageListener = discoveryService.getRequestListener(messageType);
+ if (messageListener != null) {
+ XMLStreamReader requestReader = StaxUtil.createReader(text);
+ messageListener.onRequest(requestReader);
+ }
+
+ } catch (JMSException ex) {
+ throw new TuscanyJmsException(ex);
+ } catch (XMLStreamException ex) {
+ throw new TuscanyJmsException(ex);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/bonjour/LICENSE.txt b/sandbox/old/contrib/discovery/bonjour/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/discovery/bonjour/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/discovery/bonjour/NOTICE.txt b/sandbox/old/contrib/discovery/bonjour/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/discovery/bonjour/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/discovery/bonjour/pom.xml.off b/sandbox/old/contrib/discovery/bonjour/pom.xml.off
new file mode 100644
index 0000000000..7591deac07
--- /dev/null
+++ b/sandbox/old/contrib/discovery/bonjour/pom.xml.off
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>discovery</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services.discovery</groupId>
+ <artifactId>discovery-bonjour</artifactId>
+ <name>Apache Tuscany Zeroconf Discovery</name>
+ <description>Apache Tuscany Zeroconf Discovery</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/discovery/bonjour/src/main/java/org/apache/tuscany/service/discovery/bonjour/BonjourDiscoveryService.java b/sandbox/old/contrib/discovery/bonjour/src/main/java/org/apache/tuscany/service/discovery/bonjour/BonjourDiscoveryService.java
new file mode 100644
index 0000000000..041ab2bb4c
--- /dev/null
+++ b/sandbox/old/contrib/discovery/bonjour/src/main/java/org/apache/tuscany/service/discovery/bonjour/BonjourDiscoveryService.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.bonjour;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.services.discovery.AbstractDiscoveryService;
+
+/**
+ * Discovery service implemented using Apple bonjour.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class BonjourDiscoveryService extends AbstractDiscoveryService {
+
+ /**
+ * Starts the discovery service.
+ */
+ @Override
+ public void onStart() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Stops the discovery service.
+ */
+ @Override
+ public void onStop() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Sends a message to the specified runtime.
+ *
+ * @param runtimeId Runtime id of recipient.
+ * @param content Message content.
+ * @return The message id.
+ */
+ public int sendMessage(String runtimeId, XMLStreamReader content) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/installjxta/LICENSE.txt b/sandbox/old/contrib/discovery/installjxta/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/discovery/installjxta/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/discovery/installjxta/NOTICE.txt b/sandbox/old/contrib/discovery/installjxta/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/discovery/installjxta/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/discovery/installjxta/build.xml b/sandbox/old/contrib/discovery/installjxta/build.xml
new file mode 100644
index 0000000000..28a27c8ce9
--- /dev/null
+++ b/sandbox/old/contrib/discovery/installjxta/build.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="Jxta-2.4-Installer">
+
+ <property name="jxta.version" value="2.4.1"/>
+
+ <target name="check-installed">
+ <condition property="already.installed" >
+ <and>
+ <available file="${localRepository}/org/jxta/platform/jxta/${jxta.version}/jxta-${jxta.version}.jar"/>
+ <available file="${localRepository}/org/jxta/platform/jxtaext/${jxta.version}/jxtaext-${jxta.version}.jar"/>
+ </and>
+ </condition>
+ <condition property="maven.suffix" value="">
+ <os family="unix"/>
+ </condition>
+ <condition property="maven.suffix" value=".bat">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <target name="install-jxta" depends="check-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/jxta-download/"/>
+ <get src="http://download.jxta.org/build/release/jse/2.4.1/jxta-lib-2.4.1.zip"
+ dest="${basedir}/target/jxta-download/jxta-lib-2.4.1.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <unzip src="${basedir}/target/jxta-download/jxta-lib-2.4.1.zip"
+ dest="${basedir}/target/jxta-download/jxta"
+ overwrite="false"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=org.jxta.platform -DartifactId=jxta -Dversion=${jxta.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/jxta-download/jxta/jxta.jar"/>
+ </exec>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=org.jxta.platform -DartifactId=jxtaext -Dversion=${jxta.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/jxta-download/jxta/jxtaext.jar"/>
+ </exec>
+ </target>
+
+</project>
diff --git a/sandbox/old/contrib/discovery/installjxta/pom.xml.off b/sandbox/old/contrib/discovery/installjxta/pom.xml.off
new file mode 100644
index 0000000000..2968be5efc
--- /dev/null
+++ b/sandbox/old/contrib/discovery/installjxta/pom.xml.off
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>discovery</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services.discovery</groupId>
+ <artifactId>install-jxta</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Install JXTA</name>
+ <description>Project to install JXTA 2.4 libraries</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-jxta</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant target="install-jxta">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/contrib/discovery/jxta/LICENSE.txt b/sandbox/old/contrib/discovery/jxta/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/discovery/jxta/NOTICE.txt b/sandbox/old/contrib/discovery/jxta/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/discovery/jxta/pom.xml.off b/sandbox/old/contrib/discovery/jxta/pom.xml.off
new file mode 100644
index 0000000000..cef8c30cb6
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/pom.xml.off
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>discovery</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services.discovery</groupId>
+ <artifactId>discovery-jxta</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JXTA Discovery</name>
+ <description>Apache Tuscany JXTA Discovery</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcprov-jdk14</artifactId>
+ <version>124</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jxta.platform</groupId>
+ <artifactId>jxta</artifactId>
+ <version>2.4.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.13</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryService.java b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryService.java
new file mode 100644
index 0000000000..ed3cf60fee
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryService.java
@@ -0,0 +1,320 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jxta;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.security.cert.CertificateException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import net.jxta.credential.AuthenticationCredential;
+import net.jxta.discovery.DiscoveryService;
+import net.jxta.exception.PeerGroupException;
+import net.jxta.impl.id.UUID.UUID;
+import net.jxta.impl.protocol.ResolverQuery;
+import net.jxta.membership.Authenticator;
+import net.jxta.membership.MembershipService;
+import net.jxta.peer.PeerID;
+import net.jxta.peergroup.NetPeerGroupFactory;
+import net.jxta.peergroup.PeerGroup;
+import net.jxta.platform.NetworkConfigurator;
+import net.jxta.protocol.ModuleImplAdvertisement;
+import net.jxta.resolver.QueryHandler;
+import net.jxta.resolver.ResolverService;
+
+import org.apache.tuscany.service.discovery.jxta.pdp.PeerListener;
+import org.apache.tuscany.service.discovery.jxta.prp.TuscanyQueryHandler;
+import org.apache.tuscany.spi.services.discovery.AbstractDiscoveryService;
+import org.apache.tuscany.spi.services.discovery.DiscoveryException;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.NotificationListenerAdaptor;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.omg.CORBA.Any;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Discovery service implemented using Apple bonjour.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class JxtaDiscoveryService extends AbstractDiscoveryService {
+
+ /** Well known peer group id. */
+ private static final TuscanyPeerGroupID PEER_GROUP_ID =
+ new TuscanyPeerGroupID(new UUID("aea468a4-6450-47dc-a288-a7f1bbcc5927"));
+
+ /** Default discovery interval. */
+ private static long DEFAULT_INTERVAL = 10000L;
+
+ /** Peer listener. */
+ private PeerListener peerListener;
+
+ /** Resolver service. */
+ private ResolverService resolverService;
+
+ /** Domain group. */
+ private PeerGroup domainGroup;
+
+ /** Network platform configurator. */
+ private NetworkConfigurator configurator;
+
+ /** Work scheduler. */
+ private WorkScheduler workScheduler;
+
+ /** Interval for sending discivery messages .*/
+ private long interval = DEFAULT_INTERVAL;
+
+ /** Started flag. */
+ private final AtomicBoolean started = new AtomicBoolean();
+
+ /** Message id generator. */
+ private final AtomicInteger messageIdGenerator = new AtomicInteger();
+
+ /**
+ * Adds a network configurator for this service.
+ * @param configurator Network configurator.
+ */
+ @Reference
+ public void setConfigurator(NetworkConfigurator configurator) {
+ this.configurator = configurator;
+ }
+
+ /**
+ * Adds a work scheduler for runningbackground discovery operations.
+ * @param workScheduler Work scheduler.
+ */
+ @Reference
+ public void setWorkScheduler(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ /**
+ * Sets the interval at which discovery messages are sent.
+ * @param interval Interval at which discovery messages are sent.
+ */
+ @Property
+ public void setInterval(long interval) {
+ this.interval = interval;
+ }
+
+ /**
+ * Starts the discovery service.
+ * @throws Any unexpected JXTA exception to bubble up the call stack.
+ */
+ @Override
+ public void onStart() throws DiscoveryException {
+
+ Runnable runnable = new Runnable() {
+ public void run() {
+ try {
+ startService();
+ } catch(DiscoveryException ex) {
+ throw new JxtaException(ex);
+ }
+ }
+ };
+
+ NotificationListener<Runnable> listener = new NotificationListenerAdaptor<Runnable>();
+ workScheduler.scheduleWork(runnable, listener);
+
+ }
+
+ /**
+ * Rusn the discovery service in a different thread.
+ */
+ private void startService() throws DiscoveryException {
+
+ try {
+
+ configure();
+ createAndJoinDomainGroup();
+
+ setupDiscovery();
+ setupResolver();
+
+ started.set(true);
+ peerListener.start();
+
+ } catch (PeerGroupException ex) {
+ throw new DiscoveryException(ex);
+ } catch (IOException ex) {
+ throw new DiscoveryException(ex);
+ } catch (Exception ex) {
+ throw new DiscoveryException(ex);
+ }
+
+ }
+
+ /**
+ * Sends a message to the specified runtime.
+ *
+ * @param runtimeId Runtime id of recipient. If null, the message is
+ * broadcasted to all runtimes in the domain.
+ * @param content Message content.
+ * @return The message id.
+ * @throws DiscoveryException In case of discovery errors.
+ */
+ public int sendMessage(final String runtimeId, final XMLStreamReader content) throws DiscoveryException {
+
+ if(content == null) {
+ throw new IllegalArgumentException("Content id is null");
+ }
+
+ PeerID peerID = null;
+ if(runtimeId != null) {
+ peerID = peerListener.getPeerId(runtimeId);
+ if(peerID == null) {
+ throw new DiscoveryException("Unrecognized runtime " + runtimeId);
+ }
+ }
+
+ String message = null;
+ try {
+ StaxUtil.serialize(content);
+ } catch(XMLStreamException ex) {
+ throw new DiscoveryException(ex);
+ }
+
+ int messageId = messageIdGenerator.incrementAndGet();
+
+ ResolverQuery query = new ResolverQuery();
+ query.setHandlerName(TuscanyQueryHandler.class.getSimpleName());
+ query.setQuery(message);
+ query.setSrc(domainGroup.getPeerID().toString());
+
+ if(peerID == null) {
+ resolverService.sendQuery(null, query);
+ } else {
+ resolverService.sendQuery(peerID.toString(), query);
+ }
+
+ return messageId;
+
+ }
+
+ /**
+ * Checks whether the service is started.
+ * @return True if the service is started.
+ */
+ public boolean isStarted() {
+ return started.get();
+ }
+
+ /**
+ * Stops the discovery service.
+ */
+ @Override
+ protected void onStop() {
+ peerListener.stop();
+ started.set(false);
+ }
+
+ /**
+ * Configures the platform.
+ *
+ */
+ private void configure() throws DiscoveryException {
+
+ try {
+
+ String runtimeId = getRuntimeInfo().getRuntimeId();
+
+ configurator.setName(runtimeId);
+ configurator.setHome(new File(runtimeId));
+
+ if (configurator.exists()) {
+ File pc = new File(configurator.getHome(), "PlatformConfig");
+ configurator.load(pc.toURI());
+ configurator.save();
+ } else {
+ configurator.save();
+ }
+
+ } catch (IOException ex) {
+ throw new DiscoveryException(ex);
+ } catch (CertificateException ex) {
+ throw new DiscoveryException(ex);
+ }
+
+ }
+
+ /**
+ * Creates and joins the domain peer group.
+ * @throws Exception In case of unexpected JXTA exceptions.
+ */
+ private void createAndJoinDomainGroup() throws Exception {
+
+ String domain = getRuntimeInfo().getDomain().toString();
+
+ PeerGroup netGroup = new NetPeerGroupFactory().getInterface();
+ ModuleImplAdvertisement implAdv = netGroup.getAllPurposePeerGroupImplAdvertisement();
+ domainGroup = netGroup.newGroup(PEER_GROUP_ID, implAdv, domain, "Tuscany domain group");
+
+ AuthenticationCredential authCred = new AuthenticationCredential(domainGroup, null, null);
+ MembershipService membership = domainGroup.getMembershipService();
+ Authenticator auth = membership.apply(authCred);
+
+ if (auth.isReadyForJoin()){
+ membership.join(auth);
+ } else {
+ throw new DiscoveryException("Unable to join domain group");
+ }
+
+ }
+
+ /**
+ * Sets up the resolver service.
+ */
+ private void setupResolver() {
+
+ resolverService = domainGroup.getResolverService();
+ QueryHandler queryHandler = new TuscanyQueryHandler(resolverService, this);
+ resolverService.registerHandler(TuscanyQueryHandler.class.getSimpleName(), queryHandler);
+
+ }
+
+ /**
+ * Sets up peer discovery service.
+ */
+ private void setupDiscovery() {
+
+ final DiscoveryService discoveryService = domainGroup.getDiscoveryService();
+ discoveryService.remotePublish(domainGroup.getPeerAdvertisement());
+ peerListener = new PeerListener(discoveryService, interval, getRuntimeInfo().getRuntimeId());
+
+ }
+
+ /*
+ * Well known peer grroup.
+ */
+ @SuppressWarnings("serial")
+ private static class TuscanyPeerGroupID extends net.jxta.impl.id.CBID.PeerGroupID {
+ public TuscanyPeerGroupID(UUID uuid) {
+ super(uuid);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaException.java b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaException.java
new file mode 100644
index 0000000000..06d542c705
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/JxtaException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jxta;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception that translates unexpected JXTA exceptions to tuscany runtime exceptions.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class JxtaException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the error message. *
+ * @param message Initializes the error message.
+ */
+ public JxtaException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initializes the root cause.
+ * @param cause Initializes the root cause.
+ */
+ public JxtaException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/pdp/PeerListener.java b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/pdp/PeerListener.java
new file mode 100644
index 0000000000..adc67ce263
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/pdp/PeerListener.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jxta.pdp;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.tuscany.service.discovery.jxta.JxtaException;
+
+import net.jxta.discovery.DiscoveryEvent;
+import net.jxta.discovery.DiscoveryListener;
+import net.jxta.discovery.DiscoveryService;
+import net.jxta.peer.PeerID;
+import net.jxta.protocol.DiscoveryResponseMsg;
+import net.jxta.protocol.PeerAdvertisement;
+
+/**
+ * Listener that keeps track of peers in the same peer group.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class PeerListener implements DiscoveryListener {
+
+ /** Discovery service to use. */
+ private DiscoveryService discoveryService;
+
+ /** Interval for sending discivery messages. */
+ private long interval;
+
+ /** Liveness indicator. */
+ private AtomicBoolean live = new AtomicBoolean();
+
+ /** Owning runtime. */
+ private String runtimeId;
+
+ /** Available peers. */
+ private Map<String, PeerID> availablePeers = new HashMap<String, PeerID>();
+
+ /**
+ * Initializes the JXTA discovery service.
+ * @param discoveryService JXTA discovery service.
+ * @param interval Interval between sending discovery messages.
+ * @param runtimeId Runtime that owns this peer.
+ */
+ public PeerListener(DiscoveryService discoveryService, long interval, String runtimeId) {
+ this.discoveryService = discoveryService;
+ this.interval = interval;
+ this.runtimeId = runtimeId;
+ }
+
+ /**
+ * Sends discovery messages for peer advertisements.
+ */
+ public void start() {
+
+ live.set(true);
+ discoveryService.addDiscoveryListener(this);
+ while(live.get()) {
+ discoveryService.getRemoteAdvertisements(null, DiscoveryService.PEER, null, null, 5);
+ try {
+ Thread.sleep(interval);
+ } catch(InterruptedException ex) {
+ throw new JxtaException(ex);
+ }
+
+ }
+
+ }
+
+ /**
+ * returns the peer id for the runtime id.
+ * @param runtimeId Runtime id for which peer id is requested.
+ * @return Peer id.
+ */
+ public synchronized PeerID getPeerId(String runtimeId) {
+ return availablePeers.get(runtimeId);
+ }
+
+ /**
+ * Listens for discovery event.
+ */
+ public synchronized void discoveryEvent(DiscoveryEvent event) {
+
+ DiscoveryResponseMsg res = event.getResponse();
+ Enumeration en = res.getAdvertisements();
+ if (en != null ) {
+ while (en.hasMoreElements()) {
+ PeerAdvertisement adv = (PeerAdvertisement) en.nextElement();
+ String peerName = adv.getName();
+ if(!runtimeId.equals(peerName)) {
+ availablePeers.put(adv.getName(), adv.getPeerID());
+ }
+ }
+ }
+ System.err.println("Peer view for " + runtimeId + ": " + availablePeers.keySet());
+
+ }
+
+ /**
+ * Stops the pipe listener.
+ */
+ public void stop() {
+ live.set(false);
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java
new file mode 100644
index 0000000000..f1d4a2ae2f
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/main/java/org/apache/tuscany/service/discovery/jxta/prp/TuscanyQueryHandler.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jxta.prp;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import net.jxta.impl.protocol.ResolverResponse;
+import net.jxta.protocol.ResolverQueryMsg;
+import net.jxta.protocol.ResolverResponseMsg;
+import net.jxta.resolver.QueryHandler;
+import net.jxta.resolver.ResolverService;
+
+import org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService;
+import org.apache.tuscany.service.discovery.jxta.JxtaException;
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.services.discovery.ResponseListener;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+
+/**
+ * Generic quety handler for tuscany PRP (Peer Resolver Protocol) messages. The
+ * <code>processQuery</code> method is invoked on the receiver and the <code>
+ * processResponse</code> is invoked on the sender when the receiver responds.
+ * @version $Revision$ $Date$
+ *
+ */
+public class TuscanyQueryHandler implements QueryHandler {
+
+ /** Resolver service for sending responses. */
+ private final ResolverService resolverService;
+
+ /** Discovery service. */
+ private final JxtaDiscoveryService discoveryService;
+
+ /**
+ * Initializes the JXTA resolver service and tuscany discovery service.
+ *
+ * @param resolverService Resolver service.
+ * @param discoveryService Tuscany discovery service.
+ */
+ public TuscanyQueryHandler(final ResolverService resolverService, final JxtaDiscoveryService discoveryService) {
+ this.resolverService = resolverService;
+ this.discoveryService = discoveryService;
+ }
+
+ /**
+ * Processes a query message.
+ */
+ public int processQuery(ResolverQueryMsg queryMessage) {
+
+ try {
+
+ final String message = queryMessage.getQuery();
+ final int queryId = queryMessage.getQueryId();
+ final String source = queryMessage.getSrc();
+ final String handler = queryMessage.getHandlerName();
+
+ final QName messageType = StaxUtil.getDocumentElementQName(message);
+ RequestListener messageListener = discoveryService.getRequestListener(messageType);
+ if(messageListener != null) {
+
+ XMLStreamReader requestReader = StaxUtil.createReader(message);
+ XMLStreamReader responseReader = messageListener.onRequest(requestReader);
+ String response = StaxUtil.serialize(responseReader);
+
+ ResolverResponse responseMessage = new ResolverResponse();
+ responseMessage.setResponse(response);
+ responseMessage.setHandlerName(handler);
+ responseMessage.setQueryId(queryId);
+
+ resolverService.sendResponse(source, responseMessage);
+
+ }
+ return ResolverService.OK;
+
+ } catch(XMLStreamException ex) {
+ throw new JxtaException(ex);
+ }
+
+ }
+
+ /**
+ * Processes a response message.
+ */
+ public void processResponse(ResolverResponseMsg responseMessage) {
+
+ try {
+
+ final String message = responseMessage.getResponse();
+ final int queryId = responseMessage.getQueryId();
+
+ final QName messageType = StaxUtil.getDocumentElementQName(message);
+ ResponseListener messageListener = discoveryService.getResponseListener(messageType);
+ if(messageListener != null) {
+ XMLStreamReader responseReader = StaxUtil.createReader(message);
+ messageListener.onResponse(responseReader, queryId);
+ }
+
+ } catch(XMLStreamException ex) {
+ throw new JxtaException(ex);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl b/sandbox/old/contrib/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
new file mode 100644
index 0000000000..5d0c62c516
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/main/resources/org/apache/tuscany/service/discovery/discovery.jxta.scdl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JXTA discovery components.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="discovery.jxta.scdl">
+
+ <!-- JXTA discovery service. -->
+ <component name="discovery.jxta">
+ <system:implementation.system class="org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService"/>
+ <property name="interval">10000</property>
+ </component>
+
+ <!-- JXTA platform configurator -->
+ <component name="jxta.network.configurator">
+ <system:implementation.system class="net.jxta.platform.NetworkConfigurator"/>
+ <property name="principal">user</property>
+ <property name="password">password</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java b/sandbox/old/contrib/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java
new file mode 100644
index 0000000000..54ca496ba5
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/test/java/org/apache/tuscany/service/discovery/jxta/JxtaDiscoveryServiceTestCase.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.discovery.jxta;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import net.jxta.platform.NetworkConfigurator;
+
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.services.discovery.ResponseListener;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Revision$ $Date$
+ *
+ */
+public class JxtaDiscoveryServiceTestCase extends TestCase {
+
+ public JxtaDiscoveryServiceTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public void testStartAndStop() throws Exception {
+
+ JxtaDiscoveryService discoveryService = getDiscoveryService("runtime-1", "domain");
+
+ discoveryService.start();
+ while(!discoveryService.isStarted()) {
+ }
+
+ RequestListener requestListener = new RequestListener() {
+ public XMLStreamReader onRequest(XMLStreamReader content) {
+ try {
+ return StaxUtil.createReader("<response/>");
+ } catch(XMLStreamException ex) {
+ throw new JxtaException(ex);
+ }
+ }
+ };
+
+ ResponseListener responseListener = new ResponseListener() {
+ public void onResponse(XMLStreamReader content, int messageId) {
+ }
+
+ };
+
+ discoveryService.registerRequestListener(new QName("request"), requestListener);
+ discoveryService.registerResponseListener(new QName("response"), responseListener);
+
+ XMLStreamReader reader = StaxUtil.createReader("<request/>");
+ discoveryService.sendMessage(null, reader);
+ reader.close();
+
+ }
+
+ private JxtaDiscoveryService getDiscoveryService(final String runtimeId, final String domain) {
+
+ JxtaDiscoveryService discoveryService = new JxtaDiscoveryService();
+ RuntimeInfo runtimeInfo = new RuntimeInfo() {
+ public File getApplicationRootDirectory() {
+ return null;
+ }
+ public URL getBaseURL() {
+ return null;
+ }
+ public URI getDomain() {
+ try {
+ return new URI(domain);
+ } catch (URISyntaxException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ public String getRuntimeId() {
+ return runtimeId;
+ }
+ public boolean isOnline() {
+ return false;
+ }
+
+ };
+ discoveryService.setRuntimeInfo(runtimeInfo);
+
+ NetworkConfigurator configurator = new NetworkConfigurator();
+ configurator.setPrincipal("test-user");
+ configurator.setPassword("test-password");
+
+ discoveryService.setConfigurator(configurator);
+ discoveryService.setWorkScheduler(new WorkScheduler() {
+ public <T extends Runnable> void scheduleWork(final T work, final NotificationListener<T> listener) {
+ new Thread() {
+ public void run() {
+ try {
+ work.run();
+ } catch(Exception ex) {
+ listener.workFailed(work, ex);
+ }
+ }
+ }.start();
+ }
+ public <T extends Runnable> void scheduleWork(final T work) {
+ new Thread() {
+ public void run() {
+ work.run();
+ }
+ }.start();
+ }
+ });
+ return discoveryService;
+
+ }
+
+}
diff --git a/sandbox/old/contrib/discovery/jxta/src/test/resources/test.scdl b/sandbox/old/contrib/discovery/jxta/src/test/resources/test.scdl
new file mode 100644
index 0000000000..a9ee04b7b0
--- /dev/null
+++ b/sandbox/old/contrib/discovery/jxta/src/test/resources/test.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Test for stax.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.scdl">
+
+ <component name="test.component">
+ <system:implementation.system class="test.class"/>
+ <property name="testProperty">123</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/discovery/pom.xml.off b/sandbox/old/contrib/discovery/pom.xml.off
new file mode 100644
index 0000000000..4ae18b37cd
--- /dev/null
+++ b/sandbox/old/contrib/discovery/pom.xml.off
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>services</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>discovery</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Discovery Services</name>
+
+ <modules>
+ <module>installjxta</module>
+ <module>jxta</module>
+ <module>bonjour</module>
+ </modules>
+</project>
diff --git a/sandbox/old/contrib/host-equinox/LICENSE.txt b/sandbox/old/contrib/host-equinox/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/host-equinox/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/host-equinox/pom.xml.off b/sandbox/old/contrib/host-equinox/pom.xml.off
new file mode 100644
index 0000000000..125802f332
--- /dev/null
+++ b/sandbox/old/contrib/host-equinox/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>equinox</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Equinox Runtime</name>
+ <description>Tuscany Equinox Runtime Host</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${sca.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/host-equinox/src/test/java/org/apache/tuscany/equinox/EquinoxStartTestCase.java b/sandbox/old/contrib/host-equinox/src/test/java/org/apache/tuscany/equinox/EquinoxStartTestCase.java
new file mode 100644
index 0000000000..93866cbf41
--- /dev/null
+++ b/sandbox/old/contrib/host-equinox/src/test/java/org/apache/tuscany/equinox/EquinoxStartTestCase.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.equinox;
+
+import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
+import org.eclipse.osgi.framework.internal.core.OSGi;
+import org.eclipse.osgi.framework.internal.defaultadaptor.DefaultAdaptor;
+import org.osgi.framework.Bundle;
+import junit.framework.TestCase;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class EquinoxStartTestCase extends TestCase {
+
+ public void testStart() throws Exception {
+ FrameworkAdaptor adaptor = new DefaultAdaptor(new String[]{});
+ OSGi osgi = new OSGi(adaptor);
+ osgi.launch();
+// FileInputStream stream = new FileInputStream("/Users/jmarino/workspace/tuscany/tuscany/tuscany/sandbox/jboynes/sca/runtime/equinox/src/test/resources/http.jar");
+// osgi.getBundleContext().installBundle("foo", stream);
+ for (Bundle bundle : osgi.getBundleContext().getBundles()) {
+
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bpel/container/NOTICE.txt b/sandbox/old/contrib/implementation-bpel/container/NOTICE.txt
new file mode 100644
index 0000000000..ecc68a9614
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bpel/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-bpel/container/pom.xml.off b/sandbox/old/contrib/implementation-bpel/container/pom.xml.off
new file mode 100644
index 0000000000..1d2d2def34
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bpel/container/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>container-bpel</artifactId>
+ <name>Apache Tuscany BPEL Container</name>
+ <description>Apache Tuscany BPEL Container using Apache Ode</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/bpel.system.scdl b/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/bpel.system.scdl
new file mode 100644
index 0000000000..04bcd8f9e3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/bpel.system.scdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.helper.ScriptHelperComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.helper.ScriptHelperComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..04bcd8f9e3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bpel/container/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.helper.ScriptHelperComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.helper.ScriptHelperComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-bsf/.ruleset b/sandbox/old/contrib/implementation-bsf/.ruleset
new file mode 100644
index 0000000000..a1547fea92
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/implementation-bsf/LICENSE.txt b/sandbox/old/contrib/implementation-bsf/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/implementation-bsf/NOTICE.txt b/sandbox/old/contrib/implementation-bsf/NOTICE.txt
new file mode 100644
index 0000000000..ecc68a9614
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-bsf/pom.xml.off b/sandbox/old/contrib/implementation-bsf/pom.xml.off
new file mode 100644
index 0000000000..73a0184a4f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/pom.xml.off
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>container-script</artifactId>
+ <name>Apache Tuscany Script Container</name>
+ <description>Apache Tuscany Script Container using BSF</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>bsf</groupId>
+ <artifactId>bsf</artifactId>
+ <version>2.4.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1-pre-spec-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ComponentConfiguration.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ComponentConfiguration.java
new file mode 100644
index 0000000000..b5888521cf
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ComponentConfiguration.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.WireService;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+
+/**
+ * Configuration holder for creating script components
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentConfiguration {
+
+ private String name;
+ private ScriptInstanceFactory factory;
+ private List<Class<?>> services;
+ private CompositeComponent parent;
+ private ScopeContainer scopeContainer;
+ private WireService wireService;
+ private WorkContext workContext;
+ private WorkScheduler workScheduler;
+ private ExecutionMonitor monitor;
+ private int initLevel;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ScriptInstanceFactory getFactory() {
+ return factory;
+ }
+
+ public void setFactory(ScriptInstanceFactory factory) {
+ this.factory = factory;
+ }
+
+ public List<Class<?>> getServices() {
+ return services;
+ }
+
+ public void setServices(List<Class<?>> services) {
+ this.services = services;
+ }
+
+ public CompositeComponent getParent() {
+ return parent;
+ }
+
+ public void setParent(CompositeComponent parent) {
+ this.parent = parent;
+ }
+
+ public ScopeContainer getScopeContainer() {
+ return scopeContainer;
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ this.scopeContainer = scopeContainer;
+ }
+
+ public WireService getWireService() {
+ return wireService;
+ }
+
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ public WorkContext getWorkContext() {
+ return workContext;
+ }
+
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public WorkScheduler getWorkScheduler() {
+ return workScheduler;
+ }
+
+ public void setWorkScheduler(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public ExecutionMonitor getMonitor() {
+ return monitor;
+ }
+
+ public void setMonitor(ExecutionMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ public void setInitLevel(int initLevel) {
+ this.initLevel = initLevel;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/MissingSideFileException.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/MissingSideFileException.java
new file mode 100644
index 0000000000..f8910e8d22
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/MissingSideFileException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MissingSideFileException extends LoaderException {
+
+ public MissingSideFileException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java
new file mode 100644
index 0000000000..fc4cf09c7e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * A component implementation for script languages.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScriptComponent extends AtomicComponentExtension {
+ private ScriptInstanceFactory factory;
+
+ public ScriptComponent(ComponentConfiguration config) {
+ super(config.getName(),
+ config.getParent(),
+ config.getWireService(),
+ config.getWorkContext(),
+ config.getWorkScheduler(),
+ config.getMonitor(),
+ config.getInitLevel());
+ this.factory = config.getFactory();
+ this.scope = config.getScopeContainer().getScope();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object createInstance() throws ObjectCreationException {
+ return factory.getInstance(); //(serviceBindings, context);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ Method[] methods = operation.getServiceContract().getInterfaceClass().getMethods();
+ Method method = findMethod(operation, methods);
+ return new ScriptTargetInvoker(method.getName(), this);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected void onReferenceWire(OutboundWire wire) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ factory.addContextObjectFactory(wire.getReferenceName(), new WireObjectFactory(clazz, wire, wireService));
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return scopeContainer.getInstance(this);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
new file mode 100644
index 0000000000..8916a51bcd
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+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.PropertyValue;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Extension point for creating {@link ScriptComponent}s from an assembly configuration
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScriptComponentBuilder extends ComponentBuilderExtension<ScriptImplementation> {
+
+ public ScriptComponentBuilder() {
+ }
+
+ protected Class<ScriptImplementation> getImplementationType() {
+ return ScriptImplementation.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Component build(CompositeComponent parent, ComponentDefinition<ScriptImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+
+ String name = componentDefinition.getName();
+ ScriptImplementation implementation = componentDefinition.getImplementation();
+ ScriptComponentType componentType = implementation.getComponentType();
+
+ // get list of serviceBindings provided by this component
+ Collection<ServiceDefinition> collection = componentType.getServices().values();
+ List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
+ for (ServiceDefinition serviceDefinition : collection) {
+ services.add(serviceDefinition.getServiceContract().getInterfaceClass());
+ }
+
+ // TODO: have ComponentBuilderExtension pass ScopeContainer in on build method?
+ ScopeContainer scopeContainer;
+ Scope scope = componentType.getLifecycleScope();
+ if (Scope.COMPOSITE == scope) {
+ scopeContainer = deploymentContext.getCompositeScope();
+ } else {
+ scopeContainer = scopeRegistry.getScopeContainer(scope);
+ }
+ String className = implementation.getClassName();
+ String scriptSource = implementation.getScriptSource();
+ String scriptName = implementation.getScriptName();
+ ClassLoader cl = implementation.getClassLoader();
+ ScriptInstanceFactory instanceFactory =
+ new ScriptInstanceFactory(scriptName, className, scriptSource, cl);
+
+ // get the properties for the component
+ for (PropertyValue propertyValue : componentDefinition.getPropertyValues().values()) {
+ //TODO this is not safe for since multiple instances can share mutable properties
+ instanceFactory.addContextObjectFactory(propertyValue.getName(), propertyValue.getValueFactory());
+ }
+
+ ComponentConfiguration config = new ComponentConfiguration();
+ config.setName(name);
+ config.setFactory(instanceFactory);
+ config.setServices(services);
+ config.setParent(parent);
+ config.setScopeContainer(scopeContainer);
+ config.setWireService(wireService);
+ config.setWorkContext(workContext);
+ config.setWorkScheduler(workScheduler);
+ return new ScriptComponent(config);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
new file mode 100644
index 0000000000..e467eef077
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * A componentType for script components
+ * TODO: need lifecycle methods init/destroy
+ */
+public class ScriptComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+
+ private Scope lifecycleScope = Scope.COMPOSITE;
+
+ public ScriptComponentType() {
+ }
+
+ public Scope getLifecycleScope() {
+ return lifecycleScope;
+ }
+
+ public void setLifecycleScope(Scope lifecycleScope) {
+ this.lifecycleScope = lifecycleScope;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java
new file mode 100644
index 0000000000..871f74b705
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.model.ComponentType;
+
+/**
+ * ComponentType loader for script components
+ */
+public class ScriptComponentTypeLoader extends ComponentTypeLoaderExtension<ScriptImplementation> {
+
+ public ScriptComponentTypeLoader() {
+ }
+
+ @Override
+ protected Class<ScriptImplementation> getImplementationClass() {
+ return ScriptImplementation.class;
+ }
+
+ public void load(CompositeComponent parent,
+ ScriptImplementation implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+ String sideFile = getSideFileName(implementation.getResourceName());
+ URL resource = implementation.getClassLoader().getResource(sideFile);
+ ScriptComponentType componentType;
+ if (resource == null) {
+ throw new MissingSideFileException("Component type side file not found", sideFile);
+ // TODO: or else implement introspection
+ } else {
+ componentType = loadFromSidefile(parent, resource, deploymentContext);
+ }
+ implementation.setComponentType(componentType);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ScriptComponentType loadFromSidefile(CompositeComponent parent,
+ URL url,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ ScriptComponentType scriptComponentType = new ScriptComponentType();
+ return (ScriptComponentType) loaderRegistry
+ .load(parent, scriptComponentType, url, ComponentType.class, deploymentContext);
+ }
+
+ protected String getSideFileName(String resourceName) {
+ int lastDot = resourceName.lastIndexOf('.');
+ if (lastDot != -1) {
+ resourceName = resourceName.substring(0, lastDot);
+ }
+ return resourceName + ".componentType";
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java
new file mode 100644
index 0000000000..da02c67cf9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+//import org.apache.tuscany.container.script.helper.ScriptFactory;
+
+/**
+ * Model object for a script implementation.
+ */
+public class ScriptImplementation extends AtomicImplementation<ScriptComponentType> {
+
+ private String resourceName;
+ private String className;
+ private String scriptSource;
+ private String scriptName;
+ private ClassLoader classLoader;
+
+// private ScriptFactory scriptFactory;
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getScriptSource() {
+ return scriptSource;
+ }
+
+ public void setScriptSource(String scriptSource) {
+ this.scriptSource = scriptSource;
+ }
+
+// public ScriptFactory getScriptFactory() {
+// return scriptFactory;
+// }
+//
+// public void setScriptFactory(ScriptFactory scriptFactory) {
+// this.scriptFactory = scriptFactory;
+// }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+// public ScriptFactory getScriptInstanceFactory() {
+// return scriptFactory;
+// }
+//
+// public void setScriptInstanceFactory(ScriptFactory scriptFactory) {
+// this.scriptFactory = scriptFactory;
+// }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java
new file mode 100644
index 0000000000..7664ae4227
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+import org.osoa.sca.annotations.Constructor;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Loader for handling implementation.script elements.
+ * <p/>
+ * <implementation.script script="path/foo.py" class="myclass">
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScriptImplementationLoader extends LoaderExtension<ScriptImplementation> {
+
+ private static final QName IMPLEMENTATION_SCRIPT = new QName(XML_NAMESPACE_1_0, "implementation.script");
+
+ @Constructor({"registry"})
+ public ScriptImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_SCRIPT;
+ }
+
+ public ScriptImplementation load(CompositeComponent parent, ModelObject mo, XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ String scriptName = reader.getAttributeValue(null, "script");
+ if (scriptName == null) {
+ throw new MissingResourceException("implementation element has no 'script' attribute");
+ }
+
+ String className = reader.getAttributeValue(null, "class");
+
+ LoaderUtil.skipToEndElement(reader);
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+ String scriptSource = loadSource(cl, scriptName);
+
+// ScriptInstanceFactory instanceFactory = new ScriptInstanceFactory(scriptName, className, scriptSource, cl);
+
+ ScriptImplementation implementation = new ScriptImplementation();
+ implementation.setResourceName(scriptName);
+ implementation.setScriptSource(scriptSource);
+ implementation.setClassName(className);
+ implementation.setScriptName(scriptName);
+ implementation.setClassLoader(cl);
+ //implementation.setScriptInstanceFactory(instanceFactory);
+
+ registry.loadComponentType(parent, implementation, deploymentContext);
+
+ return implementation;
+ }
+
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ URL url = cl.getResource(resource);
+ if (url == null) {
+ throw new MissingResourceException(resource);
+ }
+ InputStream is;
+ try {
+ is = url.openStream();
+ } catch (IOException e) {
+ throw new MissingResourceException(resource, e);
+ }
+ try {
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer, 0, count);
+ }
+ return source.toString();
+ } catch (IOException e) {
+ throw new LoaderException(resource, e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java
new file mode 100644
index 0000000000..645ddb5750
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * An invokable instance of a script
+ *
+ * Basically just a wrapper around a BSF engine with an optional script class object.
+ */
+public interface ScriptInstance {
+
+ Object invokeTarget(String operationName, Object[] args) throws InvocationTargetException;
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
new file mode 100644
index 0000000000..f371e7c92f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+import org.apache.bsf.BSFEngine;
+import org.apache.bsf.BSFException;
+import org.apache.bsf.BSFManager;
+
+/**
+ * ScriptFactory creates ScriptInstances for a script
+ */
+public class ScriptInstanceFactory implements ObjectFactory<ScriptInstance> {
+ protected String resourceName;
+ protected ClassLoader classLoader;
+ private String className;
+ private String scriptSource;
+ private Map<String, ObjectFactory> contextObjects;
+
+ public ScriptInstanceFactory(String resourceName,
+ String className,
+ String scriptSource,
+ ClassLoader classLoader) {
+ this.resourceName = resourceName;
+ this.classLoader = classLoader;
+ this.className = className;
+ this.scriptSource = scriptSource;
+ this.contextObjects = new HashMap<String, ObjectFactory>();
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ * <p/>
+ * objects to add to scope of the script instance
+ *
+ * @return a RhinoScriptInstance
+ */
+ //public ScriptInstanceImpl createInstance(List<Class<?>> serviceBindings, Map<String, Object> context) {
+ public ScriptInstance getInstance() throws ObjectCreationException {
+ try {
+
+ //TODO: this uses a new manager and recompiles the scrip each time, may be able to optimize
+ // but need to be careful about instance scoping
+
+ BSFManager bsfManager = new BSFManager();
+ bsfManager.setClassLoader(BSFManager.class.getClassLoader());
+
+ // TODO: hack to get Ruby working with the standalone launcher
+ Thread.currentThread().setContextClassLoader(BSFManager.class.getClassLoader());
+
+// // register any context objects (SCA properties and references)
+// for (String beanName : context.keySet()) {
+// bsfManager.registerBean(beanName, context.get(beanName));
+// }
+
+ // register any context objects (SCA properties and references)
+ for (Map.Entry<String, ObjectFactory> entry : contextObjects.entrySet()) {
+ bsfManager.registerBean(entry.getKey(), entry.getValue().getInstance());
+ }
+
+ String scriptLanguage = BSFManager.getLangFromFilename(resourceName);
+ BSFEngine bsfEngine = bsfManager.loadScriptingEngine(scriptLanguage);
+ bsfEngine.exec(resourceName, 0, 0, scriptSource);
+
+ // if there's a className then get the class object
+ Object clazz = null;
+ if (className != null) {
+ // special case for Ruby which requires a .new call
+ if ("ruby".equals(scriptLanguage)) {
+ clazz = bsfEngine.eval(null, 1, 1, className + ".new");
+ } else {
+ clazz = bsfEngine.call(null, className, null);
+ }
+ }
+
+ return new ScriptInstanceImpl(bsfEngine, clazz);
+
+ } catch (BSFException e) {
+ if (e.getTargetException() != null) {
+ throw new ObjectCreationException(e.getTargetException());
+ }
+ throw new ObjectCreationException(e.getTargetException());
+ }
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ protected Map<String, Class> getResponseClasses(List<Class> services) {
+ Map<String, Class> responseClasses = new HashMap<String, Class>();
+ if (services != null) {
+ for (Class s : services) {
+ for (Method m : s.getMethods()) {
+ responseClasses.put(m.getName(), m.getReturnType());
+ }
+ }
+ }
+ return responseClasses;
+ }
+
+ public void addContextObjectFactory(String name, ObjectFactory<?> factory) {
+ contextObjects.put(name, factory);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceImpl.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceImpl.java
new file mode 100644
index 0000000000..76c1b9d814
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.bsf.BSFEngine;
+
+/**
+ * An invokable instance of a script
+ *
+ * Basically just a wrapper around a BSF engine with an optional script class object.
+ */
+public class ScriptInstanceImpl implements ScriptInstance {
+ protected BSFEngine bsfEngine;
+ protected Object clazz;
+
+ public ScriptInstanceImpl(BSFEngine bsfEngine, Object clazz) {
+ this.bsfEngine = bsfEngine;
+ this.clazz = clazz;
+ }
+
+ public Object invokeTarget(String operationName, Object[] args) throws InvocationTargetException {
+ try {
+ return bsfEngine.call(clazz, operationName, args);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java
new file mode 100644
index 0000000000..21b84bb83b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+
+/**
+ * TargetInvoker implementation that calls a function on a ScriptInstanceImpl
+ *
+ * @version $Rev$ $Dev$
+ */
+public class ScriptTargetInvoker extends TargetInvokerExtension {
+
+ protected ScriptComponent component;
+ protected String functionName;
+
+ public ScriptTargetInvoker(String functionName, ScriptComponent component) {
+ super(null, null, null);
+ this.functionName = functionName;
+ this.component = component;
+ }
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ ScriptInstance target;
+ try {
+ target = (ScriptInstance) component.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
+ try {
+ return target.invokeTarget(functionName, (Object[]) payload);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/WireObjectFactory.java b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/WireObjectFactory.java
new file mode 100644
index 0000000000..66ba432181
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/java/org/apache/tuscany/container/script/WireObjectFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private OutboundWire wire;
+ private WireService wireService;
+
+ /**
+ * Constructor.
+ *
+ * @param interfaze the interface to inject on the client
+ * @param wire the backing wire
+ * @param wireService the wire service to create the proxy
+ */
+ public WireObjectFactory(Class<T> interfaze, OutboundWire wire, WireService wireService) {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.wireService = wireService;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ return interfaze.cast(wireService.createProxy(interfaze, wire));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..149fa2696c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/script.system.scdl b/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/script.system.scdl
new file mode 100644
index 0000000000..149fa2696c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/main/resources/META-INF/sca/script.system.scdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java
new file mode 100644
index 0000000000..aa86fa4d7d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+
+public class ScriptComponentBuilderTestCase extends TestCase {
+
+ public void testGetImplementationType() {
+ ScriptComponentBuilder builder = new ScriptComponentBuilder();
+ assertEquals(ScriptImplementation.class, builder.getImplementationType());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testBuild() throws Exception {
+ ScriptComponentBuilder builder = new ScriptComponentBuilder();
+ DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+ final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+ expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return Scope.COMPOSITE;
+ }
+ });
+ expect(deploymentContext.getCompositeScope()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return scopeContainer;
+ }
+ });
+ replay(deploymentContext);
+ ComponentDefinition<ScriptImplementation> impl =
+ new ComponentDefinition<ScriptImplementation>(new ScriptImplementation());
+ ScriptComponentType componentType = new ScriptComponentType();
+ componentType.setLifecycleScope(Scope.COMPOSITE);
+ ServiceDefinition service = new ServiceDefinition();
+ ServiceContract serviceContract = new JavaServiceContract();
+ service.setServiceContract(serviceContract);
+ componentType.add(service);
+ impl.getImplementation().setComponentType(componentType);
+
+ PropertyValue<String> pv = new PropertyValue<String>("foo", "", "");
+ ObjectFactory<String> pvFactory = (ObjectFactory<String>) createMock(ObjectFactory.class);
+ expect(pvFactory.getInstance()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return null;
+ }
+ });
+ replay(pvFactory);
+ pv.setValueFactory(pvFactory);
+ impl.add(pv);
+
+ Component component = builder.build(null, impl, deploymentContext);
+ assertNotNull(component);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testBuildCompositeScope() throws Exception {
+ ScriptComponentBuilder builder = new ScriptComponentBuilder();
+ DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+ final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+ expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return Scope.COMPOSITE;
+ }
+ });
+ expect(deploymentContext.getCompositeScope()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return scopeContainer;
+ }
+ });
+ replay(deploymentContext);
+ ComponentDefinition<ScriptImplementation> impl =
+ new ComponentDefinition<ScriptImplementation>(new ScriptImplementation());
+ ScriptComponentType componentType = new ScriptComponentType();
+ ServiceDefinition service = new ServiceDefinition();
+ ServiceContract serviceContract = new JavaServiceContract();
+ service.setServiceContract(serviceContract);
+ componentType.add(service);
+ impl.getImplementation().setComponentType(componentType);
+ Component component = builder.build(null, impl, deploymentContext);
+ assertNotNull(component);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java
new file mode 100644
index 0000000000..a16bcb67cb
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+public class ScriptComponentTestCase extends TestCase {
+
+ private ScopeContainer container;
+
+ @SuppressWarnings("unchecked")
+ public void testCreateTargetInvoker() {
+ ComponentConfiguration config = new ComponentConfiguration();
+ config.setName("foo");
+ config.setScopeContainer(container);
+ ScriptComponent component = new ScriptComponent(config);
+ Operation<Type> operation = new Operation<Type>("hashCode", null, null, null, false, null, NO_CONVERSATION);
+ operation.setServiceContract(new Contract<Type>(List.class));
+ TargetInvoker invoker = component.createTargetInvoker("hashCode", operation, null);
+ assertNotNull(invoker);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ container = EasyMock.createMock(ScopeContainer.class);
+ EasyMock.expect(container.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(container);
+ }
+
+ private class Contract<T> extends ServiceContract<T> {
+
+ public Contract(Class interfaceClass) {
+ super(interfaceClass);
+ }
+ }
+
+// TODO commented out the following test since it doesn't test refernences.
+// TODO have a reference injeciton test in ScriptInstanceFactory that tests an actual invocation
+//
+// @SuppressWarnings("unchecked")
+// public void testCreateInstanceWithRef() throws IOException {
+// WireService wireService = createMock(WireService.class);
+// expect(wireService.createProxy(isA(Wire.class))).andStubAnswer(new IAnswer() {
+// public Object answer() throws Throwable {
+// return Scope.MODULE;
+// }
+// });
+//
+// ScriptComponent pc = new ScriptComponent(null, createBSFEasy(), new HashMap(), null, null,
+// scopeContainer, wireService, null, null);
+// OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+// EasyMock.expect(wire.getReferenceName()).andReturn("foo").atLeastOnce();
+// EasyMock.replay(wire);
+// pc.addOutboundWire(wire);
+// Object o = pc.createInstance();
+// assertNotNull(o);
+// assertTrue(o instanceof ScriptInstance);
+// }
+//
+
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java
new file mode 100644
index 0000000000..d9fedfd316
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+public class ScriptComponentTypeLoaderTestCase extends TestCase {
+
+ public void testGetSideFileName() {
+ ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader();
+ assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase.mock"));
+ }
+
+ public void testGetSideFileNameNoDot() {
+ ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader();
+ assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase"));
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testLoad() throws MalformedURLException, LoaderException, XMLStreamException {
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ DeploymentContext context = EasyMock.createNiceMock(DeploymentContext.class);
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ registry.load(EasyMock.eq(parent),
+ EasyMock.isA(ScriptComponentType.class),
+ EasyMock.isA(URL.class),
+ EasyMock.isA(Class.class),
+ EasyMock.eq(context));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return EasyMock.getCurrentArguments()[1];
+ }
+ });
+ EasyMock.replay(registry);
+
+ ScriptImplementation implementation = new ScriptImplementation();
+ implementation.setResourceName("org/apache/tuscany/container/script/helper/foo.componentType");
+ implementation.setClassLoader(getClass().getClassLoader());
+ ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader();
+ loader.setLoaderRegistry(registry);
+ loader.load(parent, implementation, context);
+ assertNotNull(implementation.getComponentType());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testLoadMissingSideFile() throws MalformedURLException, LoaderException, XMLStreamException {
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ DeploymentContext context = EasyMock.createNiceMock(DeploymentContext.class);
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ registry.load(EasyMock.eq(parent),
+ EasyMock.isA(ScriptComponentType.class),
+ EasyMock.isA(URL.class),
+ EasyMock.isA(Class.class),
+ EasyMock.eq(context));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return EasyMock.getCurrentArguments()[1];
+ }
+ });
+ EasyMock.replay(registry);
+
+ ScriptImplementation implementation = new ScriptImplementation();
+ implementation.setResourceName("notthere");
+ implementation.setClassLoader(getClass().getClassLoader());
+ ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader();
+ loader.setLoaderRegistry(registry);
+ try {
+ loader.load(parent, implementation, context);
+ fail();
+ } catch (MissingSideFileException e) {
+ //expected
+ }
+ }
+
+ public void testGetImplementationClass() {
+ ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader();
+ assertEquals(ScriptImplementation.class, loader.getImplementationClass());
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java
new file mode 100644
index 0000000000..3fe6f9a47e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+
+public class ScriptComponentTypeTestCase extends TestCase {
+
+ public void testLifecycleScope() {
+ ScriptComponentType ct = new ScriptComponentType();
+ assertEquals(Scope.COMPOSITE, ct.getLifecycleScope());
+ ct.setLifecycleScope(Scope.SYSTEM);
+ assertEquals(Scope.SYSTEM, ct.getLifecycleScope());
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java
new file mode 100644
index 0000000000..f30c1dca65
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import junit.framework.TestCase;
+import static org.easymock.classextension.EasyMock.createMock;
+
+/**
+ *
+ */
+public class ScriptImplementationLoaderLoadingTestCase extends TestCase {
+
+ private LoaderRegistry registry;
+
+ private ScriptImplementationLoader loader;
+
+ public void testLoadSource() throws LoaderException {
+ String script =
+ loader.loadSource(getClass().getClassLoader(), "org/apache/tuscany/container/script/helper/foo.mock");
+ assertTrue(script.startsWith("hello"));
+ }
+
+ public void testLoadSourceMissingResource() throws LoaderException {
+ try {
+ loader.loadSource(getClass().getClassLoader(), "doesnt.exist");
+ fail();
+ } catch (MissingResourceException e) {
+ // expected
+ }
+ }
+
+ public void testGetXMLType() throws LoaderException {
+ assertEquals("http://foo", loader.getXMLType().getNamespaceURI());
+ assertEquals("bar", loader.getXMLType().getLocalPart());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ loader = new ScriptImplementationLoader(registry) {
+ public QName getXMLType() {
+ return new QName("http://foo", "bar");
+ }
+
+ public ScriptImplementation load(CompositeComponent arg0, ModelObject arg1, XMLStreamReader arg2,
+ DeploymentContext arg3) throws XMLStreamException, LoaderException {
+ return null;
+ }
+ };
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..6c22bb7c99
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+
+/**
+ *
+ */
+public class ScriptImplementationLoaderTestCase extends TestCase {
+ private CompositeComponent parent;
+
+ private XMLStreamReader reader;
+
+ private DeploymentContext deploymentContext;
+
+ private ClassLoader classLoader;
+
+ private LoaderRegistry registry;
+
+ private ScriptImplementationLoader loader;
+
+ public void testLoadNoScriptAttribute() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn(null);
+ replay(reader);
+ replay(deploymentContext);
+
+ try {
+ loader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testLoad() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn("foo.mock");
+ expect(reader.getAttributeValue(null, "class")).andReturn(null);
+ expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ expect(deploymentContext.getClassLoader()).andReturn(classLoader);
+
+ replay(reader);
+ replay(deploymentContext);
+
+ ScriptImplementationLoader mockLoader = new ScriptImplementationLoader(registry) {
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ assertSame(classLoader, cl);
+ assertEquals("foo.mock", resource);
+ return "bar";
+ }
+ };
+ mockLoader.load(parent, null, reader, deploymentContext);
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testLoadNoScriptPresent() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn("foo.py");
+ expect(reader.getAttributeValue(null, "class")).andReturn(null);
+ expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ expect(deploymentContext.getClassLoader()).andReturn(classLoader);
+
+ replay(reader);
+ replay(deploymentContext);
+
+ ScriptImplementationLoader mockLoader = new ScriptImplementationLoader(registry) {
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ assertSame(classLoader, cl);
+ assertEquals("foo.py", resource);
+ throw new MissingResourceException(resource);
+ }
+ };
+ try {
+ mockLoader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ assertEquals("foo.py", e.getMessage());
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testGetXMLType() throws LoaderException {
+ assertEquals(XML_NAMESPACE_1_0, loader.getXMLType().getNamespaceURI());
+ assertEquals("implementation.script", loader.getXMLType().getLocalPart());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ loader = new ScriptImplementationLoader(registry);
+
+ parent = createMock(CompositeComponent.class);
+ reader = createMock(XMLStreamReader.class);
+ deploymentContext = createMock(DeploymentContext.class);
+ classLoader = createMock(ClassLoader.class);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java
new file mode 100644
index 0000000000..11a99b5854
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import junit.framework.TestCase;
+
+public class ScriptImplementationTestCase extends TestCase {
+
+ public void testGetResourceName() {
+ ScriptImplementation impl = new ScriptImplementation();
+ impl.setResourceName("foo");
+ assertEquals("foo", impl.getResourceName());
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java
new file mode 100644
index 0000000000..554b6de6ad
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+import junit.framework.TestCase;
+import org.apache.bsf.BSFManager;
+import org.apache.tuscany.container.script.mock.MockBSFEngine;
+
+public class ScriptInstanceFactoryTestCase extends TestCase {
+
+ public void testCreateInstance() throws InvocationTargetException {
+ BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[]{"mock"});
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader());
+ factory.addContextObjectFactory("foo", new SingletonObjectFactory("bar"));
+ ScriptInstanceImpl instance = (ScriptInstanceImpl) factory.getInstance();
+ assertNotNull(instance);
+ assertNotNull(instance.bsfEngine);
+ }
+
+ public void testCreateInstanceNoClass() throws InvocationTargetException {
+ BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[]{"mock"});
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo.mock", null, "baz", getClass().getClassLoader());
+ factory.addContextObjectFactory("foo", new SingletonObjectFactory("bar"));
+ ScriptInstanceImpl instance = (ScriptInstanceImpl) factory.getInstance();
+ assertNotNull(instance);
+ assertNotNull(instance.bsfEngine);
+ }
+
+ public void testCreateInstanceRuby() throws InvocationTargetException {
+ BSFManager.registerScriptingEngine("ruby", MockBSFEngine.class.getName(), new String[]{"mock"});
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader());
+ factory.addContextObjectFactory("foo", new SingletonObjectFactory("bar"));
+ ScriptInstanceImpl instance = (ScriptInstanceImpl) factory.getInstance();
+ assertNotNull(instance);
+ assertNotNull(instance.bsfEngine);
+ }
+
+ public void testBadCreateInstance() throws InvocationTargetException {
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader());
+ try {
+ factory.getInstance();
+ fail();
+ } catch (ObjectCreationException e) {
+ // expected
+ }
+ }
+
+ public void testGetters() throws InvocationTargetException {
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader());
+ assertEquals(getClass().getClassLoader(), factory.getClassLoader());
+ }
+
+
+ public void testGetResponseClasses() {
+ ScriptInstanceFactory factory =
+ new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader());
+ Map<String, Class> classes = factory.getResponseClasses(Arrays.asList(new Class[]{Runnable.class}));
+ assertEquals(1, classes.size());
+ assertEquals("run", classes.keySet().iterator().next());
+ assertEquals(void.class, classes.get("run"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ private class SingletonObjectFactory implements ObjectFactory<Object> {
+ private Object instance;
+
+ public SingletonObjectFactory(Object instance) {
+ this.instance = instance;
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ return instance;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceImplTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceImplTestCase.java
new file mode 100644
index 0000000000..0f5f646cb5
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceImplTestCase.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.script.mock.MockBSFEngine;
+
+public class ScriptInstanceImplTestCase extends TestCase {
+ private ScriptInstanceImpl instance;
+
+ public void testInvokeTarget() throws InvocationTargetException {
+ assertEquals("hello:", instance.invokeTarget("hello", null));
+ }
+
+ public void testInvokeTargetException() throws InvocationTargetException {
+ try {
+ instance.invokeTarget("bang", null);
+ fail();
+ } catch (InvocationTargetException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.instance = new ScriptInstanceImpl(new MockBSFEngine(), null);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java
new file mode 100644
index 0000000000..5597d37e60
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.easymock.IAnswer;
+import org.easymock.classextension.EasyMock;
+
+public class ScriptInvokerTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testInvokeTarget() throws Exception {
+ ScriptInstance instance = EasyMock.createMock(ScriptInstance.class);
+ instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull());
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ assertEquals(2, EasyMock.getCurrentArguments().length);
+ assertEquals("operation", EasyMock.getCurrentArguments()[0]);
+ return "hello";
+ }
+ });
+
+ EasyMock.replay(instance);
+ ScriptComponent component = EasyMock.createMock(ScriptComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(instance);
+ EasyMock.replay(component);
+ ScriptTargetInvoker invoker = new ScriptTargetInvoker("operation", component);
+ assertEquals("hello", invoker.invokeTarget(new Object[]{"petra"}, TargetInvoker.NONE));
+ EasyMock.verify(instance);
+ EasyMock.verify(component);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testInvokeTargetException() throws Exception {
+ ScriptInstance instance = EasyMock.createMock(ScriptInstance.class);
+ instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull());
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ throw new RuntimeException();
+ }
+ });
+
+ EasyMock.replay(instance);
+ ScriptComponent component = EasyMock.createMock(ScriptComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(instance);
+ EasyMock.replay(component);
+ ScriptTargetInvoker invoker = new ScriptTargetInvoker("operation", component);
+ try {
+ invoker.invokeTarget(new Object[]{"petra"}, TargetInvoker.NONE);
+ fail();
+ } catch (InvocationTargetException e) {
+ // expected
+ }
+ EasyMock.verify(instance);
+ EasyMock.verify(component);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
new file mode 100644
index 0000000000..1ae65737f9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.container.script.mock;
+
+import org.apache.bsf.BSFException;
+import org.apache.bsf.util.BSFEngineImpl;
+
+public class MockBSFEngine extends BSFEngineImpl {
+
+ public Object call(Object object, String name, Object[] args) throws BSFException {
+ if ("bang".equals(name)) {
+ throw new RuntimeException(name);
+ }
+
+ String resp = name + ":";
+ if (args != null) {
+ for (Object o : args) {
+ resp += " " + String.valueOf(o);
+ }
+ }
+ return resp;
+ }
+
+ public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException {
+ // not used for the mock tests
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType
new file mode 100644
index 0000000000..9c37e1cb3e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="not.used"/>
+ </service>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock
new file mode 100644
index 0000000000..b6fc4c620b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock
@@ -0,0 +1 @@
+hello \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType
new file mode 100644
index 0000000000..9c37e1cb3e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="not.used"/>
+ </service>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock
new file mode 100644
index 0000000000..b6fc4c620b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock
@@ -0,0 +1 @@
+hello \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/container/.ruleset b/sandbox/old/contrib/implementation-groovy/container/.ruleset
new file mode 100644
index 0000000000..a1547fea92
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/implementation-groovy/container/NOTICE.txt b/sandbox/old/contrib/implementation-groovy/container/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-groovy/container/pom.xml.off b/sandbox/old/contrib/implementation-groovy/container/pom.xml.off
new file mode 100644
index 0000000000..f5d3cc272f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/pom.xml.off
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.groovy</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-groovy</artifactId>
+ <name>Apache Tuscany Groovy Container</name>
+ <description>Apache Tuscany Groovy Container</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
new file mode 100644
index 0000000000..9969647a3b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.util.HashMap;
+import java.util.List;
+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.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import groovy.lang.GroovyObject;
+
+/**
+ * The Groovy atomic component implementation. Groovy implementations may be "scripts" or classes.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GroovyAtomicComponent extends AtomicComponentExtension {
+ private final Class<? extends GroovyObject> groovyClass;
+ //FIXME properties should move up to AtomicComponentExtension
+ private final Map<String, ObjectFactory> properties;
+
+ public GroovyAtomicComponent(GroovyConfiguration configuration) {
+ super(configuration.getName(),
+ configuration.getParent(),
+ configuration.getWireService(),
+ configuration.getWorkContext(),
+ null,
+ configuration.getMonitor(),
+ configuration.getInitLevel());
+
+ this.groovyClass = configuration.getGroovyClass();
+ this.properties = new HashMap<String, ObjectFactory>();
+ assert groovyClass != null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return new GroovyInvoker(operation.getName(), this, callbackWire, workContext, monitor);
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ GroovyObject instance;
+ try {
+ instance = groovyClass.newInstance();
+ } catch (IllegalAccessException e) {
+ throw new ObjectCreationException(e);
+ } catch (InstantiationException e) {
+ throw new ObjectCreationException(e);
+ }
+
+ // inject properties
+ for (Map.Entry<String, ObjectFactory> property : properties.entrySet()) {
+ instance.setProperty(property.getKey(), property.getValue().getInstance());
+ }
+
+ // inject references
+ for (List<OutboundWire> referenceWires : getOutboundWires().values()) {
+ for (OutboundWire wire : referenceWires) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ instance.setProperty(wire.getReferenceName(), wireService.createProxy(clazz, wire));
+ }
+ }
+ return instance;
+ }
+
+ public GroovyObject getTargetInstance() throws TargetResolutionException {
+ return (GroovyObject) scopeContainer.getInstance(this);
+ }
+
+ public void addPropertyFactory(String name, ObjectFactory<?> factory) {
+ properties.put(name, factory);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java
new file mode 100644
index 0000000000..0e615977cb
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.Property;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.codehaus.groovy.control.CompilationFailedException;
+
+/**
+ * Extension point for creating {@link GroovyAtomicComponent}s from an assembly configuration
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class GroovyComponentBuilder extends ComponentBuilderExtension<GroovyImplementation> {
+
+ protected Class<GroovyImplementation> getImplementationType() {
+ return GroovyImplementation.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Component build(CompositeComponent parent,
+ ComponentDefinition<GroovyImplementation> componentDefinition,
+ DeploymentContext deploymentContext)
+ throws BuilderConfigException {
+
+ String name = componentDefinition.getName();
+ GroovyImplementation implementation = componentDefinition.getImplementation();
+ GroovyComponentType componentType = implementation.getComponentType();
+
+ int initLevel = componentType.getInitLevel();
+
+ // get list of serviceBindings provided by this component
+ Collection<ServiceDefinition> collection = componentType.getServices().values();
+ List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
+ for (ServiceDefinition serviceDefinition : collection) {
+ services.add(serviceDefinition.getServiceContract().getInterfaceClass());
+ }
+
+ // get the Groovy classloader for this deployment component
+ GroovyClassLoader groovyClassLoader = (GroovyClassLoader) deploymentContext.getExtension("groovy.classloader");
+ if (groovyClassLoader == null) {
+ groovyClassLoader = new GroovyClassLoader(implementation.getApplicationLoader());
+ deploymentContext.putExtension("groovy.classloader", groovyClassLoader);
+ }
+
+ // create the implementation class for the script
+ Class<? extends GroovyObject> groovyClass;
+ try {
+ String script = implementation.getScript();
+ // REVIEW JFM can we cache the class?
+ groovyClass = groovyClassLoader.parseClass(script);
+ } catch (CompilationFailedException e) {
+ throw new BuilderConfigException(name, e);
+ }
+ // TODO deal with init and destroy
+
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName(name);
+ configuration.setGroovyClass(groovyClass);
+ configuration.setParent(parent);
+
+ configuration.setWireService(wireService);
+ configuration.setWorkContext(workContext);
+ configuration.setInitLevel(initLevel);
+ configuration.setServices(services);
+ configuration.setMonitor(monitor);
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+
+ // handle properties
+ for (Property<?> property : componentType.getProperties().values()) {
+ ObjectFactory<?> factory = property.getDefaultValueFactory();
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ return component;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentType.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentType.java
new file mode 100644
index 0000000000..91b80827a7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentType.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Model object representing a Groovy component type
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class GroovyComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+ private Scope lifecycleScope;
+
+ public Scope getLifecycleScope() {
+ return lifecycleScope;
+ }
+
+ public void setLifecycleScope(Scope lifecycleScope) {
+ this.lifecycleScope = lifecycleScope;
+ }
+
+ public GroovyComponentType() {
+ implementationScope = Scope.COMPOSITE;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoader.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoader.java
new file mode 100644
index 0000000000..f811440027
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoader.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.model.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GroovyComponentTypeLoader extends ComponentTypeLoaderExtension<GroovyImplementation> {
+
+ @Override
+ protected Class<GroovyImplementation> getImplementationClass() {
+ return GroovyImplementation.class;
+ }
+
+ public void load(CompositeComponent parent, GroovyImplementation implementation, DeploymentContext context)
+ throws LoaderException {
+ URL resource = implementation.getApplicationLoader().getResource(getSideFileName(implementation));
+ GroovyComponentType componentType;
+ if (resource == null) {
+ //TODO this should be replaced by loadFromIntrospection,
+ componentType = new GroovyComponentType();
+ } else {
+ componentType = loadFromSidefile(resource, context);
+ }
+
+ // for now, default to composite
+ componentType.setLifecycleScope(Scope.COMPOSITE);
+ implementation.setComponentType(componentType);
+ }
+
+ protected GroovyComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext)
+ throws LoaderException {
+ GroovyComponentType ct = new GroovyComponentType();
+ return (GroovyComponentType)loaderRegistry.load(null,ct, url, GroovyComponentType.class, deploymentContext);
+ }
+
+ private String getSideFileName(GroovyImplementation implementation) {
+ String baseName = getResourceName(implementation);
+ int lastDot = baseName.lastIndexOf('.');
+ if (lastDot != -1) {
+ baseName = baseName.substring(0, lastDot);
+ }
+ return baseName + ".componentType";
+ }
+
+ protected String getResourceName(GroovyImplementation implementation) {
+ return implementation.getScriptResourceName();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyConfiguration.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyConfiguration.java
new file mode 100644
index 0000000000..49fa4c2a41
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyConfiguration.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import groovy.lang.GroovyObject;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Encapsulates confuration for a Groovy-based atomic component
+ *
+ * @version $Rev$ $Date$
+ */
+public class GroovyConfiguration {
+
+ private CompositeComponent parent;
+ private int initLevel;
+ private Map<String, Member> referenceSites = new HashMap<String, Member>();
+ private Map<String, Member> propertySites = new HashMap<String, Member>();
+ private Map<String, Member> callbackSites = new HashMap<String, Member>();
+ private List<Class<?>> serviceInterfaces = new ArrayList<Class<?>>();
+ private WireService wireService;
+ private WorkContext workContext;
+ private String name;
+ private Class<? extends GroovyObject> groovyClass;
+ private List<Class<?>> services;
+ private ExecutionMonitor monitor;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Class<? extends GroovyObject> getGroovyClass() {
+ return groovyClass;
+ }
+
+ public void setGroovyClass(Class<? extends GroovyObject> groovyClass) {
+ this.groovyClass = groovyClass;
+ }
+
+ public CompositeComponent getParent() {
+ return parent;
+ }
+
+ public void setParent(CompositeComponent parent) {
+ this.parent = parent;
+ }
+
+ public List<Class<?>> getServiceInterfaces() {
+ return serviceInterfaces;
+ }
+
+ public void addServiceInterface(Class<?> serviceInterface) {
+ serviceInterfaces.add(serviceInterface);
+ }
+
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ public void setInitLevel(int initLevel) {
+ this.initLevel = initLevel;
+ }
+
+ public List<Class<?>> getServices() {
+ return services;
+ }
+
+ public void setServices(List<Class<?>> services) {
+ this.services = services;
+ }
+
+ public Map<String, Member> getReferenceSite() {
+ return referenceSites;
+ }
+
+ public void addReferenceSite(String name, Member member) {
+ referenceSites.put(name, member);
+ }
+
+ public Map<String, Member> getCallbackSite() {
+ return callbackSites;
+ }
+
+ public void addCallbackSite(String name, Member member) {
+ callbackSites.put(name, member);
+ }
+
+ public Map<String, Member> getPropertySites() {
+ return propertySites;
+ }
+
+ public void addPropertySite(String name, Member member) {
+ propertySites.put(name, member);
+ }
+
+ public WireService getWireService() {
+ return wireService;
+ }
+
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ public WorkContext getWorkContext() {
+ return workContext;
+ }
+
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public ExecutionMonitor getMonitor() {
+ return monitor;
+ }
+
+ public void setMonitor(ExecutionMonitor monitor) {
+ this.monitor = monitor;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyImplementation.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyImplementation.java
new file mode 100644
index 0000000000..0a48507a11
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyImplementation.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * Model object for a Groovy implementation.
+ */
+public class GroovyImplementation extends AtomicImplementation<GroovyComponentType> {
+
+ //the Groovy source to be executed
+ private String script;
+
+ // the application class loader, we need this to construct a GroovyClassLoader in GroovyComponentBuilder
+ private ClassLoader applicationLoader;
+
+ // TODO , Suggest to change the current script to scriptContent, acutally, we need script file name to get component side file name.
+ private String scriptResourceName;
+
+ public String getScriptResourceName() {
+ return scriptResourceName;
+ }
+
+ public void setScriptResourceName(String scriptResourceName) {
+ this.scriptResourceName = scriptResourceName;
+ }
+
+ /**
+ * Return Application class loader to be executed.
+ */
+ public ClassLoader getApplicationLoader() {
+ return applicationLoader;
+ }
+
+ /**
+ * Sets the Application class loader to be executed.
+ */
+ public void setApplicationLoader(ClassLoader applicationLoader) {
+ this.applicationLoader = applicationLoader;
+ }
+
+ /**
+ * Returns the Groovy source to be executed.
+ */
+ public String getScript() {
+ return script;
+ }
+
+ /**
+ * Sets the Groovy source to be executed.
+ */
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java
new file mode 100644
index 0000000000..20492e5fc2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import groovy.lang.GroovyObject;
+
+/**
+ * Dispatches to a Groovy implementation instance
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class GroovyInvoker extends TargetInvokerExtension {
+
+ protected GroovyAtomicComponent component;
+ protected String operation;
+ protected boolean cacheable;
+
+ public GroovyInvoker(String operation,
+ GroovyAtomicComponent component,
+ InboundWire wire,
+ WorkContext context,
+ ExecutionMonitor monitor) {
+ super(wire, context, monitor);
+ this.component = component;
+ this.operation = operation;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ /**
+ * Dispatches to the the target. TODO support conversational dispatch
+ */
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ GroovyObject target = null;
+ try {
+ target = component.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
+ Object[] args = (Object[]) payload;
+ try {
+ return target.invokeMethod(operation, args);
+ } catch (Exception ex) {
+ throw new InvocationTargetException(ex);
+ }
+ }
+
+ public GroovyInvoker clone() throws CloneNotSupportedException {
+ return (GroovyInvoker) super.clone();
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/ImplementationLoader.java b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/ImplementationLoader.java
new file mode 100644
index 0000000000..a025d0d7eb
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/java/org/apache/tuscany/container/groovy/ImplementationLoader.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Loader for handling <groovy:implementation> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImplementationLoader extends LoaderExtension<GroovyImplementation> {
+ private static final QName IMPLEMENTATION_GROOVY =
+ new QName("http://tuscany.apache.org/xmlns/groovy/1.0", "implementation.groovy");
+
+ public ImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_GROOVY;
+ }
+
+ public GroovyImplementation load(CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String script = reader.getAttributeValue(null, "script");
+ if (script == null) {
+ throw new MissingResourceException("No script supplied");
+ }
+ String source = loadSource(deploymentContext.getClassLoader(), script);
+
+ LoaderUtil.skipToEndElement(reader);
+
+ GroovyImplementation implementation = new GroovyImplementation();
+ implementation.setScript(source);
+ implementation.setApplicationLoader(deploymentContext.getClassLoader());
+ implementation.setScriptResourceName(script);
+
+ return implementation;
+ }
+
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ URL url = cl.getResource(resource);
+ if (url == null) {
+ throw new MissingResourceException(resource);
+ }
+ InputStream is;
+ try {
+ is = url.openStream();
+ } catch (IOException e) {
+ throw new MissingResourceException(resource, e);
+ }
+ try {
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer, 0, count);
+ }
+ return source.toString();
+ } catch (IOException e) {
+ throw new LoaderException(resource, e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..54fc745d10
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="groovy.extension">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.groovy</group>
+ <name>tuscany-groovy</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="GroovyLoader">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.ImplementationLoader"/>
+ </component>
+
+ <component name="GroovyComponentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.GroovyComponentTypeLoader"/>
+ </component>
+
+ <component name="GroovyBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.GroovyComponentBuilder"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/groovy.system.scdl b/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/groovy.system.scdl
new file mode 100644
index 0000000000..54fc745d10
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/main/resources/META-INF/sca/groovy.system.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="groovy.extension">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.groovy</group>
+ <name>tuscany-groovy</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="GroovyLoader">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.ImplementationLoader"/>
+ </component>
+
+ <component name="GroovyComponentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.GroovyComponentTypeLoader"/>
+ </component>
+
+ <component name="GroovyBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.groovy.GroovyComponentBuilder"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java
new file mode 100644
index 0000000000..5a89e048bc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+
+import groovy.lang.GroovyObject;
+import junit.framework.TestCase;
+import org.apache.tuscany.container.groovy.mock.AsyncTarget;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+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;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AsyncInvokerTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testInvoke() throws Exception {
+ GroovyObject instance = createMock(GroovyObject.class);
+ expect(instance.invokeMethod("invoke", null)).andReturn(null).once();
+ replay(instance);
+ GroovyAtomicComponent component = EasyMock.createMock(GroovyAtomicComponent.class);
+ expect(component.getTargetInstance()).andReturn(instance);
+ EasyMock.replay(component);
+ ExecutionMonitor monitor = createMock(ExecutionMonitor.class);
+ replay(monitor);
+
+ 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);
+ Method method = AsyncTarget.class.getMethod("invoke");
+ method.setAccessible(true);
+ InboundWire wire = createMock(InboundWire.class);
+ GroovyInvoker invoker = new GroovyInvoker("invoke", component, wire, context, monitor);
+ Message msg = new MessageImpl();
+ invoker.invoke(msg);
+ verify(instance);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoaderTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoaderTestCase.java
new file mode 100644
index 0000000000..025867c226
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/GroovyComponentTypeLoaderTestCase.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GroovyComponentTypeLoaderTestCase extends TestCase {
+
+ public void testLoad() throws Exception {
+ GroovyComponentTypeLoader loader = new GroovyComponentTypeLoader();
+ GroovyImplementation impl = new GroovyImplementation();
+ impl.setScriptResourceName("Foo.groovy");
+ impl.setApplicationLoader(Thread.currentThread().getContextClassLoader());
+ loader.load(null, impl, null);
+ GroovyComponentType type = impl.getComponentType();
+ assertEquals(Scope.COMPOSITE, type.getLifecycleScope());
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ImplementationLoaderTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..9dcb440aa2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ImplementationLoaderTestCase.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+
+import junit.framework.TestCase;
+import static org.easymock.classextension.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationLoaderTestCase extends TestCase {
+ private CompositeComponent parent;
+ private XMLStreamReader reader;
+ private DeploymentContext deploymentContext;
+ private ClassLoader classLoader;
+ private LoaderRegistry registry;
+ private ImplementationLoader loader;
+
+ public void testNoScriptAttribute() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn(null);
+ replay(reader);
+ replay(deploymentContext);
+
+ try {
+ loader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testNoScriptPresent() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn("foo.groovy");
+ expect(deploymentContext.getClassLoader()).andReturn(classLoader);
+
+ replay(reader);
+ replay(deploymentContext);
+
+ ImplementationLoader mockLoader = new ImplementationLoader(registry) {
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ assertSame(classLoader, cl);
+ assertEquals("foo.groovy", resource);
+ throw new MissingResourceException(resource);
+ }
+ };
+ try {
+ mockLoader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ assertEquals("foo.groovy", e.getIdentifier());
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testLoadScript() throws LoaderException {
+ String script = loader.loadSource(getClass().getClassLoader(),
+ "org/apache/tuscany/container/groovy/mock/TestScript.groovy");
+ assertEquals("Test Script", script);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = EasyMock.createMock(LoaderRegistry.class);
+ loader = new ImplementationLoader(registry);
+
+ parent = EasyMock.createMock(CompositeComponent.class);
+ reader = EasyMock.createMock(XMLStreamReader.class);
+ deploymentContext = EasyMock.createMock(DeploymentContext.class);
+ classLoader = EasyMock.createMock(ClassLoader.class);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java
new file mode 100644
index 0000000000..60c6f41cca
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+import junit.framework.TestCase;
+import org.apache.tuscany.container.groovy.mock.Greeting;
+import static org.apache.tuscany.test.ArtifactFactory.createWireService;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+import org.easymock.EasyMock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class PropertyTestCase extends TestCase {
+
+ private static final String SCRIPT = "import org.apache.tuscany.container.groovy.mock.Greeting;\n"
+ + "class Foo implements Greeting{\n"
+ + " String property;\n"
+ + " public String greet(String name){\n"
+ + " return property;\n"
+ + " }\n"
+ + " public String setWire(Greeting ref){\n"
+ + " return null;\n"
+ + " }\n"
+ + "}";
+
+ private ScopeContainer scopeContainer;
+ private Class<? extends GroovyObject> implClass;
+
+ /**
+ * Tests injecting a simple property type on a Groovy implementation instance
+ */
+ public void testPropertyInjection() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName("source");
+ configuration.setGroovyClass(implClass);
+ configuration.setServices(services);
+ configuration.setWireService(createWireService());
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ component.setScopeContainer(scopeContainer);
+ ObjectFactory<?> factory = createMock(ObjectFactory.class);
+ expect((String) factory.getInstance()).andReturn("bar");
+ replay(factory);
+ component.addPropertyFactory("property", factory);
+ Greeting greeting = (Greeting) component.getTargetInstance();
+ assertEquals("bar", greeting.greet("foo"));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ GroovyClassLoader cl = new GroovyClassLoader(getClass().getClassLoader());
+ implClass = cl.parseClass(SCRIPT);
+ scopeContainer = createMock(ScopeContainer.class);
+ expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return ((AtomicComponent) getCurrentArguments()[0]).createInstance();
+ }
+ });
+ EasyMock.expect(scopeContainer.getScope()).andReturn(Scope.COMPOSITE).anyTimes();
+ replay(scopeContainer);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java
new file mode 100644
index 0000000000..4aab15552e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.model.Scope;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+import junit.framework.TestCase;
+import org.apache.tuscany.container.groovy.mock.Greeting;
+import static org.apache.tuscany.test.ArtifactFactory.createWireService;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ScriptInvokeTestCase extends TestCase {
+
+ private static final String SCRIPT = "def greet(name) { return name }";
+
+ private Class<? extends GroovyObject> implClass;
+ private ScopeContainer scopeContainer;
+
+ /**
+ * Tests the invocation of a Groovy "script" as opposed to a class
+ */
+ public void testBasicScriptInvocation() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName("source");
+ configuration.setGroovyClass(implClass);
+ configuration.setServices(services);
+ configuration.setWireService(createWireService());
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ component.setScopeContainer(scopeContainer);
+ GroovyObject object = component.getTargetInstance();
+ assertEquals("foo", object.invokeMethod("greet", "foo"));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ GroovyClassLoader cl = new GroovyClassLoader(getClass().getClassLoader());
+ implClass = cl.parseClass(SCRIPT);
+ scopeContainer = createMock(ScopeContainer.class);
+ expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return ((AtomicComponent) getCurrentArguments()[0]).createInstance();
+ }
+ });
+ EasyMock.expect(scopeContainer.getScope()).andReturn(Scope.COMPOSITE).anyTimes();
+ replay(scopeContainer);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java
new file mode 100644
index 0000000000..618c65285f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+import junit.framework.TestCase;
+import org.apache.tuscany.container.groovy.mock.Greeting;
+import org.apache.tuscany.test.ArtifactFactory;
+import static org.apache.tuscany.test.ArtifactFactory.createLocalInboundWire;
+import static org.apache.tuscany.test.ArtifactFactory.createLocalOutboundWire;
+import static org.apache.tuscany.test.ArtifactFactory.createWireService;
+import static org.apache.tuscany.test.ArtifactFactory.terminateWire;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reportMatcher;
+import static org.easymock.EasyMock.verify;
+import org.easymock.IAnswer;
+import org.easymock.IArgumentMatcher;
+import org.easymock.EasyMock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class WireTestCase extends TestCase {
+
+ private static final String SCRIPT = "import org.apache.tuscany.container.groovy.mock.Greeting;"
+ + "class Foo implements Greeting{"
+ + " Greeting wire;"
+ + " "
+ + " String setWire(Greeting ref){"
+ + " wire = ref;"
+ + " return null;"
+ + " };"
+ + " "
+ + " String greet(String name){"
+ + " return wire.greet(name); "
+ + " };"
+ + "}";
+
+ private static final String SCRIPT2 = "import org.apache.tuscany.container.groovy.mock.Greeting;"
+ + "class Foo implements Greeting{"
+ + " Greeting wire;"
+ + " "
+ + " String setWire(Greeting ref){"
+ + " wire = ref;"
+ + " return null;"
+ + " };"
+ + " "
+ + " public String greet(String name){"
+ + " return name; "
+ + " }"
+ + "}";
+
+ private Class<? extends GroovyObject> implClass1;
+ private Class<? extends GroovyObject> implClass2;
+ private ScopeContainer scopeContainer;
+ private WireService wireService;
+
+ /**
+ * Tests a basic invocation down a source wire
+ */
+ public void testReferenceWireInvocation() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName("source");
+ configuration.setGroovyClass(implClass1);
+ configuration.setServices(services);
+ configuration.setWireService(createWireService());
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ component.setScopeContainer(scopeContainer);
+ OutboundWire wire = createLocalOutboundWire("wire", Greeting.class);
+ terminateWire(wire);
+
+ TargetInvoker invoker = createMock(TargetInvoker.class);
+ expect(invoker.isCacheable()).andReturn(false);
+ Message response = new MessageImpl();
+ response.setBody("foo");
+ expect(invoker.invoke(eqMessage())).andReturn(response);
+ replay(invoker);
+
+ for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(invoker);
+ }
+ component.addOutboundWire(wire);
+ Greeting greeting = (Greeting) component.getTargetInstance();
+ assertEquals("foo", greeting.greet("foo"));
+ verify(invoker);
+ }
+
+ // todo this could be generalized and moved to test module
+ public static Message eqMessage() {
+ reportMatcher(new IArgumentMatcher() {
+ public boolean matches(Object object) {
+ if (!(object instanceof Message)) {
+ return false;
+ }
+ final Message msg = (Message) object;
+ Object[] body = (Object[]) msg.getBody();
+ return "foo".equals(body[0]);
+ }
+
+ public void appendTo(StringBuffer stringBuffer) {
+ }
+ });
+ return null;
+ }
+
+
+ /**
+ * Tests a basic invocation to a target
+ */
+ public void testTargetInvocation() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName("source");
+ configuration.setGroovyClass(implClass2);
+ configuration.setServices(services);
+ configuration.setWireService(createWireService());
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ component.setScopeContainer(scopeContainer);
+ Operation<Type> operation = new Operation<Type>("greet", null, null, null, false, null, NO_CONVERSATION);
+ TargetInvoker invoker = component.createTargetInvoker(null, operation, null);
+ assertEquals("foo", invoker.invokeTarget(new String[]{"foo"}, TargetInvoker.NONE));
+ }
+
+
+ /**
+ * Tests a basic invocation down a target wire
+ */
+ public void testTargetWireInvocation() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ GroovyConfiguration configuration = new GroovyConfiguration();
+ configuration.setName("source");
+ configuration.setGroovyClass(implClass2);
+ configuration.setServices(services);
+ configuration.setWireService(createWireService());
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ component.setScopeContainer(scopeContainer);
+ InboundWire wire = createLocalInboundWire("Greeting", Greeting.class);
+ terminateWire(wire);
+ for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(component.createTargetInvoker(null, chain.getOperation(), null));
+ }
+ component.addInboundWire(wire);
+ Greeting greeting = wireService.createProxy(Greeting.class, component.getInboundWire("Greeting"));
+ assertEquals("foo", greeting.greet("foo"));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected void setUp() throws Exception {
+ super.setUp();
+ GroovyClassLoader cl = new GroovyClassLoader(getClass().getClassLoader());
+ implClass1 = cl.parseClass(SCRIPT);
+ implClass2 = cl.parseClass(SCRIPT2);
+ scopeContainer = createMock(ScopeContainer.class);
+ expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return ((AtomicComponent) getCurrentArguments()[0]).createInstance();
+ }
+ });
+ EasyMock.expect(scopeContainer.getScope()).andReturn(Scope.COMPOSITE).anyTimes();
+ replay(scopeContainer);
+ wireService = ArtifactFactory.createWireService();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/AsyncTarget.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/AsyncTarget.java
new file mode 100644
index 0000000000..8918c3dfd5
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/AsyncTarget.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy.mock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AsyncTarget {
+
+ void invoke();
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/Greeting.java b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/Greeting.java
new file mode 100644
index 0000000000..b975491f16
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/java/org/apache/tuscany/container/groovy/mock/Greeting.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.groovy.mock;
+
+public interface Greeting {
+
+ String setWire(Greeting ref);
+ String greet(String name);
+}
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/resources/Foo.groovy b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/Foo.groovy
new file mode 100644
index 0000000000..314b3f6a59
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/Foo.groovy
@@ -0,0 +1,15 @@
+//import org.apache.tuscany.container.groovy.mock.Greeting;
+
+class Foo {
+
+ /*implements Greeting {
+ Greeting wire;
+
+ void setWire(Greeting ref){
+ wire = ref;
+ };
+
+ String greet(String name){
+ return wire.greet(name);
+ }; */
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..deb07b60ff
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:groovy="http://tuscany.apache.org/xmlns/groovy/1.0"
+ name="groovy.test">
+
+ <component name="Greeting">
+ <groovy:implementation.groovy script="Foo.groovy"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-groovy/container/src/test/resources/org/apache/tuscany/container/groovy/mock/TestScript.groovy b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/org/apache/tuscany/container/groovy/mock/TestScript.groovy
new file mode 100644
index 0000000000..f0b0a3a9d4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/container/src/test/resources/org/apache/tuscany/container/groovy/mock/TestScript.groovy
@@ -0,0 +1 @@
+Test Script \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/pom.xml.off b/sandbox/old/contrib/implementation-groovy/pom.xml.off
new file mode 100644
index 0000000000..3eb39c8a9e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/pom.xml.off
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.groovy</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Groovy Extension</name>
+
+ <modules>
+ <module>container</module>
+ <module>samples</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-groovy/samples/helloworld/pom.xml.off
new file mode 100644
index 0000000000..e5ffd0e040
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/pom.xml.off
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.groovy.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworld-groovy</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Groovy helloworld Sample</name>
+ <description>A helloworld sample using a single SCA Groovy component</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.groovy</groupId>
+ <artifactId>tuscany-groovy</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..257270f65a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+ public static void main(String[] args) throws Exception {
+
+ HelloWorldService helloWorldService = CurrentCompositeContext.getContext().locateService(HelloWorldService.class,
+ "HelloWorldComponent");
+
+ System.out.println(helloWorldService.sayHello(args.length < 1 ? "world" : args[0]));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..616552eab9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+
+
+public interface HelloWorldService {
+ public String sayHello(String name);
+}
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..0fe242bb8c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.groovy b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.groovy
new file mode 100644
index 0000000000..0586230322
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/HelloWorld.groovy
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class HelloWorldServiceImpl {
+ public String sayHello(String name) {
+ System.out.println("[HelloWorld for Groovy] Hello " + name);
+ return "Hello "+name;
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/LICENSE.txt b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..25d78feeac
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,1277 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE TUSCANY SUBCOMPONENTS:
+
+The Apache Tuscany distribution includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+For the Eclipse Modeling Framework component and the Celtix binding:
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript container component:
+
+Mozilla Public License 1.1 (MPL 1.1)
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original Code,
+prior Modifications used by a Contributor, and the Modifications made by that
+particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+combination of the Original Code and Modifications, in each case including
+portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+accepted in the software development community for the electronic transfer of
+data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified as
+the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+extent possible, whether at the time of the initial grant or subsequently
+acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+substance or structure of either the Original Code or any previous
+Modifications. When Covered Code is released as a series of files, a
+Modification is:
+ A. Any addition to or deletion from the contents of a file
+containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+which is described in the Source Code notice required by Exhibit A as Original
+Code, and which, at the time of its release under this License is not already
+Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+hereafter acquired, including without limitation, method, process, and
+apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+making modifications to it, including all modules it contains, plus any
+associated interface definition files, scripts used to control compilation and
+installation of an Executable, or source code differential comparisons against
+either the Original Code or another well known, available Covered Code of the
+Contributor's choice. The Source Code can be in a compressed or archival form,
+provided the appropriate decompression or de-archiving software is widely
+available for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+exercising rights under, and complying with all of the terms of, this License
+or a future version of this License issued under Section 6.1. For legal
+entities, "You" includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this definition, "control"
+means (a) the power, direct or indirect, to cause the direction or management
+of such entity, whether by contract or otherwise, or (b) ownership of more
+than fifty percent (50%) of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property claims:
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Initial Developer to use, reproduce, modify, display,
+perform, sublicense and distribute the Original Code (or portions thereof)
+with or without Modifications, and/or as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or selling
+of Original Code, to make, have made, use, practice, sell, and offer for sale,
+and/or otherwise dispose of the Original Code (or portions thereof).
+ (c) the licenses granted in this Section 2.1(a) and
+(b) are effective on the date Initial Developer first distributes Original
+Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+granted: 1) for code that You delete from the Original Code; 2) separate from
+the Original Code; or 3) for infringements caused by: i) the modification of
+the Original Code or ii) the combination of the Original Code with other
+software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Contributor, to use, reproduce, modify, display,
+perform, sublicense and distribute the Modifications created by such
+Contributor (or portions thereof) either on an unmodified basis, with other
+Modifications, as Covered Code and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+of Modifications made by that Contributor either alone and/or in combination
+with its Contributor Version (or portions of such combination), to make, use,
+sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications
+made by that Contributor (or portions thereof); and 2) the combination of
+Modifications made by that Contributor with its Contributor Version (or
+portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+effective on the date Contributor first makes Commercial Use of the Covered
+Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+granted: 1) for any code that Contributor has deleted from the Contributor
+Version; 2) separate from the Contributor Version; 3) for infringements
+caused by: i) third party modifications of Contributor Version or ii) the
+combination of Modifications made by that Contributor with other software
+(except as part of the Contributor Version) or other devices; or 4) under
+Patent Claims infringed by Covered Code in the absence of Modifications made
+by that Contributor.
+
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+governed by the terms of this License, including without limitation Section
+2.2. The Source Code version of Covered Code may be distributed only under the
+terms of this License or a future version of this License released under
+Section 6.1, and You must include a copy of this License with every copy of
+the Source Code You distribute. You may not offer or impose any terms on any
+Source Code version that alters or restricts the applicable version of this
+License or the recipients' rights hereunder. However, You may include an
+additional document offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+made available in Source Code form under the terms of this License either on
+the same media as an Executable version or via an accepted Electronic
+Distribution Mechanism to anyone to whom you made an Executable version
+available; and if made available via Electronic Distribution Mechanism, must
+remain available for at least twelve (12) months after the date it initially
+became available, or at least six (6) months after a subsequent version of
+that particular Modification has been made available to such recipients. You
+are responsible for ensuring that the Source Code version remains available
+even if the Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+file documenting the changes You made to create that Covered Code and the date
+of any change. You must include a prominent statement that the Modification is
+derived, directly or indirectly, from Original Code provided by the Initial
+Developer and including the name of the Initial Developer in (a) the Source
+Code, and (b) in any notice in an Executable version or related documentation
+in which You describe the origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+intellectual property rights is required to exercise the rights granted by
+such Contributor under Sections 2.1 or 2.2, Contributor must include a text
+file with the Source Code distribution titled "LEGAL" which describes the
+claim and the party making the claim in sufficient detail that a recipient
+will know whom to contact. If Contributor obtains such knowledge after the
+Modification is made available as described in Section 3.2, Contributor shall
+promptly modify the LEGAL file in all copies Contributor makes available
+thereafter and shall take other steps (such as notifying appropriate mailing
+lists or newsgroups) reasonably calculated to inform those who received the
+Covered Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+interface and Contributor has knowledge of patent licenses which are
+reasonably necessary to implement that API, Contributor must also include this
+information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+Section 3.4(a) above, Contributor believes that Contributor's Modifications
+are Contributor's original creation(s) and/or Contributor has sufficient
+rights to grant the rights conveyed by this License.
+
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+Code. If it is not possible to put such notice in a particular Source Code
+file due to its structure, then You must include such notice in a location
+(such as a relevant directory) where a user would be likely to look for such a
+notice. If You created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also duplicate
+this License in any documentation for the Source Code where You describe
+recipients' rights or ownership rights relating to Covered Code. You may
+choose to offer, and to charge a fee for, warranty, support, indemnity or
+liability obligations to one or more recipients of Covered Code. However, You
+may do so only on Your own behalf, and not on behalf of the Initial Developer
+or any Contributor. You must make it absolutely clear than any such warranty,
+support, indemnity or liability obligation is offered by You alone, and You
+hereby agree to indemnify the Initial Developer and every Contributor for any
+liability incurred by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+requirements of Section 3.1-3.5 have been met for that Covered Code, and if
+You include a notice stating that the Source Code version of the Covered Code
+is available under the terms of this License, including a description of how
+and where You have fulfilled the obligations of Section 3.2. The notice must
+be conspicuously included in any notice in an Executable version, related
+documentation or collateral in which You describe recipients' rights relating
+to the Covered Code. You may distribute the Executable version of Covered Code
+or ownership rights under a license of Your choice, which may contain terms
+different from this License, provided that You are in compliance with the
+terms of this License and that the license for the Executable version does not
+attempt to limit or alter the recipient's rights in the Source Code version
+from the rights set forth in this License. If You distribute the Executable
+version under a different license You must make it absolutely clear that any
+terms which differ from this License are offered by You alone, not by the
+Initial Developer or any Contributor. You hereby agree to indemnify the
+Initial Developer and every Contributor for any liability incurred by the
+Initial Developer or such Contributor as a result of any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+not governed by the terms of this License and distribute the Larger Work as a
+single product. In such a case, You must make sure the requirements of this
+License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Code due to statute,
+judicial order, or regulation then You must: (a) comply with the terms of this
+License to the maximum extent possible; and (b) describe the limitations and
+the code they affect. Such description must be included in the LEGAL file
+described in Section 3.4 and must be included with all distributions of the
+Source Code. Except to the extent prohibited by statute or regulation, such
+description must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has attached
+the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+and/or new versions of the License from time to time. Each version will be
+given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+License, You may always continue to use it under the terms of that version.
+You may also choose to use such Covered Code under the terms of any subsequent
+version of the License published by Netscape. No one other than Netscape has
+the right to modify the terms applicable to Covered Code created under this
+License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+only do in order to apply it to code which is not already Covered Code
+governed by this License), You must (a) rename Your license so that the
+phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or
+any confusingly similar phrase do not appear in your license (except to note
+that your license differs from this License) and (b) otherwise make it clear
+that Your version of the license contains terms which differ from the Mozilla
+Public License and Netscape Public License. (Filling in the name of the
+Initial Developer, Original Code or Contributor in the notice described in
+Exhibit A shall not of themselves be deemed to be modifications of this
+License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+automatically if You fail to comply with terms herein and fail to cure such
+breach within 30 days of becoming aware of the breach. All sublicenses to the
+Covered Code which are properly granted shall survive any termination of this
+License. Provisions which, by their nature, must remain in effect beyond the
+termination of this License shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+claim (excluding declatory judgment actions) against Initial Developer or a
+Contributor (the Initial Developer or Contributor against whom You file such
+action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+infringes any patent, then any and all rights granted by such Participant to
+You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+from Participant terminate prospectively, unless if within 60 days after
+receipt of notice You either: (i) agree in writing to pay Participant a
+mutually agreeable reasonable royalty for Your past and future use of
+Modifications made by such Participant, or (ii) withdraw Your litigation claim
+with respect to the Contributor Version against such Participant. If within
+60 days of notice, a reasonable royalty and payment arrangement are not
+mutually agreed upon in writing by the parties or the litigation claim is not
+withdrawn, the rights granted by Participant to You under Sections 2.1 and/or
+2.2 automatically terminate at the expiration of the 60 day notice period
+specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+Contributor Version, directly or indirectly infringes any patent, then any
+rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are
+revoked effective as of the date You first made, used, sold, distributed, or
+had made, Modifications made by that Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+alleging that such Participant's Contributor Version directly or indirectly
+infringes any patent where such claim is resolved (such as by license or
+settlement) prior to the initiation of patent infringement litigation, then
+the reasonable value of the licenses granted by such Participant under
+Sections 2.1 or 2.2 shall be taken into account in determining the amount or
+value of any payment or license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above, all
+end user license agreements (excluding distributors and resellers) which have
+been validly granted by You or any distributor hereunder prior to termination
+shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY
+SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
+WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
+EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
+DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
+OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
+EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in 48
+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and
+"commercial computer software documentation," as such terms are used in 48
+C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject matter
+hereof. If any provision of this License is held to be unenforceable, such
+provision shall be reformed only to the extent necessary to make it
+enforceable. This License shall be governed by California law provisions
+(except to the extent applicable law, if any, provides otherwise), excluding
+its conflict-of-law provisions. With respect to disputes in which at least one
+party is a citizen of, or an entity chartered or registered to do business in
+the United States of America, any litigation relating to this License shall be
+subject to the jurisdiction of the Federal Courts of the Northern District of
+California, with venue lying in Santa Clara County, California, with the
+losing party responsible for costs, including without limitation, court costs
+and reasonable attorneys' fees and expenses. The application of the United
+Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly, out of its
+utilization of rights under this License and You agree to work with Initial
+Developer and Contributors to distribute such responsibility on an equitable
+basis. Nothing herein is intended or shall be deemed to constitute any
+admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits
+you to utilize portions of the Covered Code under Your choice of the MPL or
+the alternative licenses, if any, specified by the Initial Developer in the
+file described in Exhibit A.
+
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+language governing rights and
+ limitations under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+Portions created by
+ ______________________ are Copyright (C) ______
+_______________________. All Rights
+ Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms of
+the _____ license (the [___] License), in which case the provisions of
+[______] License are applicable instead of those above. If you wish to allow
+use of your version of this file only under the terms of the [____] License
+and not to allow others to use your version of this file under the MPL,
+indicate your decision by deleting the provisions above and replace them
+with the notice and other provisions required by the [___] License. If you do
+not delete the provisions above, a recipient may use your version of this file
+under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+the notices in the Source Code files of the Original Code. You should use the
+text of this Exhibit A rather than the text found in the Original Code Source
+Code for Your Modifications.]
+
+
+===============================================================================
+
+For the JAX-WS Reference Implementation component:
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/NOTICE b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache Tuscany distribution. ==
+=========================================================================
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Celtix project (http://celtix.objectweb.org/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..3f4eddc38a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:groovy="http://tuscany.apache.org/xmlns/groovy/1.0"
+ name="groovy.helloWorld">
+
+ <component name="HelloWorldComponent">
+ <groovy:implementation.groovy script="HelloWorld.groovy"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..6f567025d8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import java.net.URL;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class HelloWorldTestCase extends SCATestCase{
+ private HelloWorldService helloWorldService;
+
+ protected void setUp() throws Exception {
+ URL scdl = getClass().getClassLoader().getResource("META-INF/sca/groovy.system.scdl");
+ addExtension("GroovyContainer", scdl);
+ setApplicationSCDL(HelloWorldService.class, "META-INF/sca/default.scdl");
+ super.setUp();
+
+ CompositeContext context = CurrentCompositeContext.getContext();
+ helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public void testHelloWorld() throws Exception {
+ assertEquals("Hello World", helloWorldService.sayHello("World"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-groovy/samples/pom.xml.off b/sandbox/old/contrib/implementation-groovy/samples/pom.xml.off
new file mode 100644
index 0000000000..67f1a49457
--- /dev/null
+++ b/sandbox/old/contrib/implementation-groovy/samples/pom.xml.off
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.groovy</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.groovy.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the Groovy extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${specVersion}</artifactId>
+ <version>${scaVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-javascript/container/NOTICE.txt b/sandbox/old/contrib/implementation-javascript/container/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-javascript/container/pom.xml.off b/sandbox/old/contrib/implementation-javascript/container/pom.xml.off
new file mode 100644
index 0000000000..d33eb0f6b3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/pom.xml.off
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.javascript</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-javascript</artifactId>
+ <name>Apache Tuscany JavaScript Container</name>
+ <description>Apache Tuscany JavaScript Container</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId> <!-- Reqd for E4X -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
new file mode 100644
index 0000000000..6615eabecc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
+
+/**
+ * The JavaScript component implementation.
+ */
+public class JavaScriptComponent extends AtomicComponentExtension {
+
+ private final Map<String, Object> properties;
+
+ private RhinoScript rhinoScript;
+
+ public JavaScriptComponent(String name, RhinoScript rhinoScript, Map<String, Object> properties,
+ CompositeComponent parent, WireService wireService,
+ WorkContext workContext,
+ ExecutionMonitor monitor) {
+ super(name, parent, wireService, workContext, null, monitor, 0);
+
+ this.rhinoScript = rhinoScript;
+ this.properties = properties;
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+
+ Map<String, Object> context = new HashMap<String, Object>(getProperties());
+
+ for (List<OutboundWire> referenceWires : getOutboundWires().values()) {
+ for (OutboundWire wire : referenceWires) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ Object wireProxy = wireService.createProxy(clazz, wire);
+ //since all types that may be used in the reference interface may not be known to Rhino
+ //using the wireProxy as is will fail result in type conversion exceptions in cases where
+ //Rhino does not know enough of the tpypes used. Hence introduce a interceptor proxy,
+ //with weak typing (java.lang.Object) so that Rhino's call to the proxy succeeds. Then
+ //within this interceptor proxy perform data mediations required to correctly call the
+ //referenced service.
+ Class<?> businessInterface = wire.getServiceContract().getInterfaceClass();
+ JavaScriptReferenceProxy interceptingProxy =
+ new JavaScriptReferenceProxy(businessInterface,
+ wireProxy,
+ rhinoScript.createInstanceScope(context));
+ context.put(wire.getReferenceName(), interceptingProxy.createProxy());
+
+ }
+ }
+
+ return rhinoScript.createRhinoScriptInstance(context);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return new JavaScriptInvoker(operation.getName(), this, callbackWire, workContext, monitor);
+ }
+
+ // TODO: move all the following up to AtomicComponentExtension?
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public RhinoScriptInstance getTargetInstance() throws TargetResolutionException {
+ return (RhinoScriptInstance) scopeContainer.getInstance(this);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java
new file mode 100644
index 0000000000..5d9ed491f9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.container.javascript.utils.xmlfromxsd.XmlInstanceRegistry;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+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.PropertyValue;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Extension point for creating {@link JavaScriptComponent}s from an assembly configuration
+ */
+public class JavaScriptComponentBuilder extends ComponentBuilderExtension<JavaScriptImplementation> {
+
+ private static String head = "var xmlInstanceMap = new Array();";
+
+ private static String part1 = "xmlInstanceMap[\"";
+
+ private static String part2 = "\"] = ";
+
+ private static String part3 = ";";
+
+ private static String getXmlObjectFunction =
+ "function getXmlObject(xmlElementNamespace, xmlElementName){\n" +
+ "return xmlInstanceMap[xmlElementNamespace + \"#\" + xmlElementName];\n}";
+
+ XmlInstanceRegistry xmlInstRegistry;
+
+ @Constructor({"xmlInstRegistry"})
+ public JavaScriptComponentBuilder(@Autowire XmlInstanceRegistry reg) {
+ this.xmlInstRegistry = reg;
+ }
+
+ protected Class<JavaScriptImplementation> getImplementationType() {
+ return JavaScriptImplementation.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Component build(CompositeComponent parent, ComponentDefinition<JavaScriptImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+
+ String name = componentDefinition.getName();
+ JavaScriptImplementation implementation = componentDefinition.getImplementation();
+ JavaScriptComponentType componentType = implementation.getComponentType();
+
+ // get list of serviceBindings provided by this component
+ Collection<ServiceDefinition> collection = componentType.getServices().values();
+ List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
+ for (ServiceDefinition serviceDefinition : collection) {
+ services.add(serviceDefinition.getServiceContract().getInterfaceClass());
+ //do this for the set of references also
+ enhanceRhinoScript(serviceDefinition, implementation);
+ }
+
+ // get the properties for the component
+ Collection<PropertyValue<?>> propertyValues = componentDefinition.getPropertyValues().values();
+ Map<String, Object> properties = new HashMap<String, Object>();
+ for (PropertyValue propertyValue : propertyValues) {
+ properties.put(propertyValue.getName(), propertyValue.getValueFactory().getInstance());
+ }
+
+ RhinoScript rhinoScript = implementation.getRhinoScript();
+
+ return new JavaScriptComponent(name, rhinoScript, properties, parent, wireService, workContext , monitor);
+ }
+
+ private void enhanceRhinoScript(ServiceDefinition serviceDefn, JavaScriptImplementation implementation) throws BuilderConfigException {
+ //if the service interface of the component is a wsdl get the wsdl interface and generate
+ //xml instances for the elements in it. Add these xml instances to the rhinoscript.
+ //TODO : when interface.wsdl and wsdl registry is integrated remove this hardcoding and
+ //obtain wsdl from the interface.wsdl or wsdl registry
+ String wsdlPath = "org/apache/tuscany/container/javascript/rhino/helloworld.wsdl";
+
+ //this if block is a tempfix to get other testcases working. Again when a the interface.wsdl
+ //extension is in place this will be deleted. Right now this is the only way we know that
+ //a js has to do with an interface that is wsdl.
+ if (!implementation.getRhinoScript().getScriptName().endsWith("e4x.js")) {
+ return;
+ }
+
+ try {
+ Map<String, XmlObject> xmlInstanceMap = xmlInstRegistry.getXmlInstance(wsdlPath);
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(head);
+ sb.append("\n");
+ for (String xmlInstanceKey : xmlInstanceMap.keySet()) {
+ sb.append(part1);
+ sb.append(xmlInstanceKey);
+ sb.append(part2);
+ sb.append(xmlInstanceMap.get(xmlInstanceKey).toString());
+ sb.append(part3);
+ sb.append("\n");
+ }
+ // System.out.println(" **** - " + sb.toString());
+
+ sb.append(getXmlObjectFunction);
+
+ RhinoScript rhinoScript = implementation.getRhinoScript();
+ sb.append(rhinoScript.getScript());
+ rhinoScript.setScript(sb.toString());
+ rhinoScript.initScriptScope(rhinoScript.getScriptName(), sb.toString(), null, rhinoScript.getClassLoader());
+ implementation.setRhinoScript(rhinoScript);
+
+ } catch (Exception e) {
+ throw new BuilderConfigException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentType.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentType.java
new file mode 100644
index 0000000000..68f96226b8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentType.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+public class JavaScriptComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+
+ public JavaScriptComponentType() {
+ implementationScope = Scope.COMPOSITE;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java
new file mode 100644
index 0000000000..b94abcd5eb
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoSCAConfig;
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaScriptComponentTypeLoader extends ComponentTypeLoaderExtension<JavaScriptImplementation> {
+
+ private JavaInterfaceProcessorRegistry processorRegistry;
+
+ public JavaScriptComponentTypeLoader(@Autowire JavaInterfaceProcessorRegistry processorRegistry) {
+ this.processorRegistry = processorRegistry;
+ }
+
+ @Override
+ protected Class<JavaScriptImplementation> getImplementationClass() {
+ return JavaScriptImplementation.class;
+ }
+
+ protected JavaScriptComponentType loadByIntrospection(CompositeComponent parent,
+ JavaScriptImplementation implementation,
+ DeploymentContext deploymentContext) throws
+ MissingResourceException,
+ InvalidServiceContractException {
+
+ RhinoScript rhinoScript = implementation.getRhinoScript();
+ RhinoSCAConfig scaConfig = rhinoScript.getSCAConfig();
+ if (!scaConfig.hasSCAConfig()) {
+ throw new IllegalArgumentException(
+ "must use either .componentType side file or JS SCA varriable definition");
+ }
+
+ // FIXME this should be a system service, not instantiated here
+ JavaScriptComponentType componentType = new JavaScriptIntrospector(null, processorRegistry)
+ .introspectScript(scaConfig, rhinoScript.getClassLoader());
+
+ return componentType;
+ }
+
+ protected String getResourceName(JavaScriptImplementation implementation) {
+ return implementation.getRhinoScript().getScriptName();
+ }
+
+ // TODO: must be possible to move all the following up in to ComponentTypeLoaderExtension
+
+ public void load(CompositeComponent parent, JavaScriptImplementation implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+
+ URL resource = implementation.getRhinoScript().getClassLoader().getResource(getSideFileName(implementation));
+ JavaScriptComponentType componentType;
+ if (resource == null) {
+ try {
+ componentType = loadByIntrospection(parent, implementation, deploymentContext);
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException("Invalid service contract", e);
+ }
+ } else {
+ componentType = loadFromSidefile(resource, deploymentContext);
+ }
+
+ implementation.setComponentType(componentType);
+ }
+
+ protected JavaScriptComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext)
+ throws LoaderException {
+ JavaScriptComponentType jsct = new JavaScriptComponentType();
+ return (JavaScriptComponentType) loaderRegistry.load(null,jsct, url, ComponentType.class, deploymentContext);
+ }
+
+ private String getSideFileName(JavaScriptImplementation implementation) {
+ String baseName = getResourceName(implementation);
+ int lastDot = baseName.lastIndexOf('.');
+ if (lastDot != -1) {
+ baseName = baseName.substring(0, lastDot);
+ }
+ return baseName + ".componentType";
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java
new file mode 100644
index 0000000000..7de479f096
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * Model object for a JavaScript implementation.
+ */
+public class JavaScriptImplementation extends AtomicImplementation<JavaScriptComponentType> {
+
+ private RhinoScript rhinoScript;
+
+ public RhinoScript getRhinoScript() {
+ return rhinoScript;
+ }
+
+ public void setRhinoScript(RhinoScript rhinoScript) {
+ this.rhinoScript = rhinoScript;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java
new file mode 100644
index 0000000000..247c01abe6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Constructor;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+
+/**
+ * Loader for handling JavaScript <js:implementation.js> elements.
+ */
+public class JavaScriptImplementationLoader extends LoaderExtension<JavaScriptImplementation> {
+ private static final QName IMPLEMENTATION_JAVASCRIPT =
+ new QName("http://tuscany.apache.org/xmlns/js/1.0", "implementation.js");
+
+ @Constructor({"registry"})
+ public JavaScriptImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_JAVASCRIPT;
+ }
+
+ public JavaScriptImplementation load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String script = reader.getAttributeValue(null, "script");
+ if (script == null) {
+ throw new MissingResourceException("No script supplied");
+ }
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+ String source = loadSource(cl, script);
+
+ LoaderUtil.skipToEndElement(reader);
+
+ JavaScriptImplementation implementation = new JavaScriptImplementation();
+ RhinoScript rhinoScript = new RhinoScript(script, source, null, cl);
+ implementation.setRhinoScript(rhinoScript);
+ registry.loadComponentType(parent, implementation, deploymentContext);
+ return implementation;
+ }
+
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ URL url = cl.getResource(resource);
+ if (url == null) {
+ throw new MissingResourceException(resource);
+ }
+ InputStream is;
+ try {
+ is = url.openStream();
+ } catch (IOException e) {
+ throw new MissingResourceException(resource, resource, e);
+ }
+ try {
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer, 0, count);
+ }
+ return source.toString();
+ } catch (IOException e) {
+ throw new LoaderException(resource, e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptIntrospector.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptIntrospector.java
new file mode 100644
index 0000000000..ea1306b5cf
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptIntrospector.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.util.Iterator;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+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.container.javascript.rhino.RhinoSCAConfig;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+
+/**
+ * Introspects JavaScript files for SCA configuration
+ */
+public class JavaScriptIntrospector {
+
+ private WSDLDefinitionRegistry wsdlRegistry;
+ private JavaInterfaceProcessorRegistry processorRegistry;
+
+ public JavaScriptIntrospector(@Autowire WSDLDefinitionRegistry wsdlRegistry,
+ @Autowire JavaInterfaceProcessorRegistry processorRegistry) {
+ this.wsdlRegistry = wsdlRegistry;
+ this.processorRegistry = processorRegistry;
+ }
+
+ public JavaScriptComponentType introspectScript(RhinoSCAConfig scaConfig, ClassLoader cl)
+ throws MissingResourceException, InvalidServiceContractException {
+ JavaScriptComponentType componentType = new JavaScriptComponentType();
+ introspectJavaInterface(componentType, cl, scaConfig.getJavaInterface());
+ introspectWSDLInterface(componentType, cl, scaConfig.getWSDLNamespace(), scaConfig.getWSDLPortType(),
+ scaConfig.getWSDLLocation());
+ introspectReferences(componentType, cl, scaConfig.getReferences());
+ introspectProperties(componentType, cl, scaConfig.getProperties());
+ introspectScope(componentType, scaConfig.getScope());
+ return componentType;
+ }
+
+ private void introspectScope(JavaScriptComponentType componentType, Scope scope) {
+ if (scope != null) {
+ componentType.setImplementationScope(scope);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void introspectJavaInterface(ComponentType componentType, ClassLoader cl, String serviceClass)
+ throws MissingResourceException, InvalidServiceContractException {
+ if (serviceClass != null) {
+ ServiceDefinition service = new ServiceDefinition();
+ try {
+ ServiceContract<?> sc = processorRegistry.introspect(Class.forName(serviceClass));
+ service.setServiceContract(sc);
+ service.setName(sc.getInterfaceClass().getSimpleName());
+ componentType.add(service);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Interface not found", e);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void introspectWSDLInterface(ComponentType componentType, ClassLoader cl, String wsdlNamespace,
+ String wsdlPortType, String wsdlLocation) {
+ if (wsdlNamespace == null && wsdlPortType == null && wsdlLocation == null) {
+ return;
+ }
+
+ PortType portType = null;
+ if (wsdlLocation != null) {
+ portType = readWSDLPortType(wsdlNamespace, wsdlPortType, wsdlLocation, portType);
+ } else {
+ portType = getPortType(wsdlNamespace, wsdlPortType);
+ }
+
+ ServiceDefinition service = new ServiceDefinition();
+ WSDLServiceContract wsdlSC = new WSDLServiceContract();
+ wsdlSC.setPortType(portType);
+ service.setServiceContract(wsdlSC);
+ componentType.add(service);
+ }
+
+ private PortType readWSDLPortType(String wsdlNamespace, String wsdlPortType, String wsdlLocation,
+ PortType portType) {
+ Definition wsdlDefinition;
+ try {
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ wsdlDefinition = reader.readWSDL(wsdlLocation.toString());
+ } catch (WSDLException e) {
+ throw new RuntimeException(e);
+
+ }
+ Map portTypes = wsdlDefinition.getPortTypes();
+ for (Iterator i = portTypes.keySet().iterator(); i.hasNext();) {
+ QName portTypeQN = (QName) i.next();
+ if (wsdlNamespace != null) {
+ if (!portTypeQN.getNamespaceURI().equals(wsdlNamespace)) {
+ continue;
+ }
+ }
+ if (wsdlPortType != null) {
+ if (!portTypeQN.getLocalPart().equals(wsdlPortType)) {
+ continue;
+ }
+ }
+ if (portType != null) {
+ throw new RuntimeException("multiple matching portTypes in wsdl: " + wsdlLocation);
+ }
+ portType = (PortType) portTypes.get(portTypeQN);
+ }
+ if (portType == null) {
+ throw new RuntimeException("portType not found in wsdl: " + wsdlLocation);
+ }
+ return portType;
+ }
+
+ private PortType getPortType(String wsdlNamespace, String wsdlPortType) {
+ if (wsdlPortType == null) {
+ throw new IllegalArgumentException("must specify the wsdlPortType in script SCA config");
+ }
+ PortType portType = null;
+ if (wsdlNamespace != null) {
+ QName portTypeQN = new QName(wsdlNamespace.toString(), wsdlPortType.toString());
+ portType = wsdlRegistry.getPortType(portTypeQN);
+ if (portType == null) {
+ throw new IllegalArgumentException("no WSDL registered for portType: " + portTypeQN);
+ }
+ } else {
+ // wsdlRegistry.getPortType(wsdlPortType.toString());
+ if (portType == null) {
+ throw new IllegalArgumentException("no WSDL registered for portType:" + wsdlPortType);
+ }
+ }
+ return portType;
+ }
+
+
+ private void introspectProperties(ComponentType componentType, ClassLoader cl, Map properties) {
+ }
+
+ private void introspectReferences(ComponentType componentType, ClassLoader cl, Map references) {
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java
new file mode 100644
index 0000000000..0323ba14ba
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
+
+/**
+ * Dispatches to a JavaScript implementation instance
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaScriptInvoker extends TargetInvokerExtension {
+
+ private JavaScriptComponent context;
+
+ private String functionName;
+
+ public JavaScriptInvoker(String functionName,
+ JavaScriptComponent context,
+ InboundWire wire,
+ WorkContext workContext,
+ ExecutionMonitor monitor) {
+ super(wire, workContext, monitor);
+ this.functionName = functionName;
+ this.context = context;
+ }
+
+ /**
+ * Invokes a function on a script instance
+ */
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ RhinoScriptInstance target = null;
+ try {
+ target = context.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
+ return target.invokeFunction(functionName, (Object[]) payload);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptRefInvocInterceptor.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptRefInvocInterceptor.java
new file mode 100644
index 0000000000..f8c978f833
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptRefInvocInterceptor.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.Wrapper;
+import org.mozilla.javascript.xml.XMLObject;
+
+/**
+ * This Interceptor encasulates the data mediation required by the JavaScriptReferenceProxy. The
+ * invocation handler of this class traps the javascript reference calls, performs data mediation
+ * and calls then calls the actual referred service. This classes implementation is subject to
+ * review and change when the DataMediation infrastructure of Tuscany is ready.
+ *
+ */
+public class JavaScriptRefInvocInterceptor implements InvocationHandler {
+ private Object actualProxy;
+
+ private Class wireInterface;
+
+ private Scriptable instanceScope;
+
+ JavaScriptRefInvocInterceptor(Object wireProxy, Class wireIfc, Scriptable instScope) {
+ this.actualProxy = wireProxy;
+ this.wireInterface = wireIfc;
+ this.instanceScope = instScope;
+ }
+
+ public Object invoke(Object arg0, Method method, Object[] args) throws Throwable {
+ // TODO Auto-generated method stub
+ Context cx = Context.enter();
+ try {
+ Method invokedMethod = getInvokedMethod(method.getName());
+ Object[] tranformedArgs = new Object[args.length];
+ for (int count = 0; count < args.length; ++count) {
+ tranformedArgs[count] = fromJavaScript(invokedMethod.getParameterTypes()[count], args[count]);
+ }
+
+ Object response = invokedMethod.invoke(actualProxy, tranformedArgs);
+ response = toJavaScript(response, instanceScope, cx);
+ return response;
+ } finally {
+ Context.exit();
+ }
+ }
+
+ private Method getInvokedMethod(String methodName) {
+ Method[] methods = wireInterface.getMethods();
+
+ for (int count = 0; count < methods.length; ++count) {
+ if (methods[count].getName().equals(methodName)) {
+ return methods[count];
+ }
+ }
+ throw new RuntimeException("Unable to find invocation method");
+ }
+
+ protected Object fromJavaScript(Class reqArgType, Object jsArg) throws Exception {
+ Object javaArg;
+ if (Context.getUndefinedValue().equals(jsArg)) {
+ javaArg = null;
+ } else if (jsArg instanceof XMLObject) {
+ // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
+ Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) jsArg, "copy", new Object[0]);
+ Wrapper wrapper = (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]);
+ javaArg = wrapper.unwrap();
+
+ XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(javaArg.toString().getBytes()));
+ StAXOMBuilder staxOMBuilder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlReader);
+ javaArg = staxOMBuilder.getDocumentElement();
+ } else if (jsArg instanceof Wrapper) {
+ javaArg = ((Wrapper) jsArg).unwrap();
+ } else {
+ if (reqArgType != null) {
+ javaArg = Context.jsToJava(jsArg, reqArgType);
+ } else {
+ javaArg = Context.jsToJava(jsArg, String.class);
+ }
+ }
+
+ return javaArg;
+ }
+
+ protected Object toJavaScript(Object retVal, Scriptable scope, Context cx) throws RuntimeException {
+ Object jsRetVal;
+ if (retVal instanceof OMElement) {
+ try {
+ XmlObject xmlObject = XmlObject.Factory.parse(retVal.toString());
+ Object jsXML = cx.getWrapFactory().wrap(cx, scope, xmlObject, XmlObject.class);
+ jsRetVal = cx.newObject(scope, "XML", new Object[] { jsXML });
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ } else if (retVal instanceof XmlObject) {
+ Object jsXML = cx.getWrapFactory().wrap(cx, scope, (XmlObject) retVal, XmlObject.class);
+ jsRetVal = cx.newObject(scope, "XML", new Object[] { jsXML });
+ } else {
+ jsRetVal = Context.toObject(retVal, scope);
+ }
+
+ return jsRetVal;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptReferenceProxy.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptReferenceProxy.java
new file mode 100644
index 0000000000..8b432872b8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/JavaScriptReferenceProxy.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import net.sf.cglib.asm.ClassWriter;
+import net.sf.cglib.asm.CodeVisitor;
+import net.sf.cglib.asm.Constants;
+import net.sf.cglib.asm.Type;
+
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.Wrapper;
+import org.mozilla.javascript.xml.XMLObject;
+
+/**
+ * This is a proxy that will mediate reference calls from the JavaScript. The mediation code here will be reviewed when the DataMediation
+ * infrastructure is ready. This proxy assmes that there is no verloading of service methods on the reference interface i.e. there are no two service
+ * methods that have the same method name or operation name.
+ */
+public class JavaScriptReferenceProxy {
+
+ private Class interfaze;
+
+ private Object wireProxy;
+
+ private Scriptable instanceScope;
+
+ public JavaScriptReferenceProxy(Class interfaze, Object wireProxy, Scriptable instScope) {
+ this.interfaze = interfaze;
+ this.wireProxy = wireProxy;
+ this.instanceScope = instScope;
+ }
+
+ public Object createProxy() {
+ try {
+ GenericProxyClassLoader classloader = new GenericProxyClassLoader();
+ final byte[] byteCode = generateGenericInterface(interfaze);
+
+ Class genericInterface = classloader.defineClass(byteCode);
+ InvocationHandler proxyHandler = new JavaScriptRefInvocInterceptor(wireProxy,
+ interfaze, instanceScope);
+ // return genericInterface.cast(Proxy.newProxyInstance(classloader, new Class[]{genericInterface}, proxyHandler));
+ return Proxy.newProxyInstance(classloader,
+ new Class[]{genericInterface},
+ proxyHandler);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static byte[] generateGenericInterface(Class serviceInterface) {
+ String interfazeName = serviceInterface.getCanonicalName();
+ ClassWriter cw = new ClassWriter(false);
+
+ cw.visit(Constants.V1_5,
+ Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT + Constants.ACC_INTERFACE,
+ interfazeName.replace('.',
+ '/'),
+ "java/lang/Object",
+ null,
+ serviceInterface.getSimpleName() + ".java");
+
+ StringBuffer argsAndReturn = new StringBuffer("(");
+ Method[] methods = serviceInterface.getMethods();
+ for (int count = 0; count < methods.length; ++count) {
+ argsAndReturn = new StringBuffer("(");
+ Class[] paramTypes = methods[count].getParameterTypes();
+ Class returnType = methods[count].getReturnType();
+
+ for (int paramCount = 0; paramCount < paramTypes.length; ++paramCount) {
+ argsAndReturn.append(Type.getType(Object.class));
+ }
+ argsAndReturn.append(")");
+ argsAndReturn.append(Type.getType(Object.class));
+
+ Class[] exceptionTypes = methods[count].getExceptionTypes();
+ String[] exceptions = new String[exceptionTypes.length];
+ for (int excCount = 0; excCount < exceptionTypes.length; ++excCount) {
+ exceptions[excCount] = exceptionTypes[excCount].getName();
+ exceptions[excCount] = exceptions[excCount].replace('.',
+ '/');
+ }
+
+ CodeVisitor cv = cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
+ methods[count].getName(),
+ argsAndReturn.toString(),
+ exceptions,
+ null);
+ cw.visitEnd();
+ }
+
+ cw.visitEnd();
+
+ return cw.toByteArray();
+ }
+
+ private class GenericProxyClassLoader extends ClassLoader {
+ public Class defineClass(byte[] byteArray) {
+ try {
+ return defineClass(null,
+ byteArray,
+ 0,
+ byteArray.length);
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java
new file mode 100644
index 0000000000..b2064f9110
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Function;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.Wrapper;
+import org.mozilla.javascript.xml.XMLObject;
+
+/**
+ * An invoker for a specific function in a JavaScript script
+ */
+public class RhinoFunctionInvoker {
+
+ private Scriptable instanceScope;
+
+ private Function function;
+
+ private Class responseClass;
+
+ public RhinoFunctionInvoker(Scriptable instanceScope, Function function, Class responseClass) {
+ this.instanceScope = instanceScope;
+ this.function = function;
+ this.responseClass = responseClass;
+ }
+
+ public Object invoke(Object[] args) {
+ Context cx = Context.enter();
+ try {
+
+ Object[] jsArgs = toJavaScript(args, instanceScope, cx);
+ Object jsResponse = function.call(cx, instanceScope, instanceScope, jsArgs);
+ Object response = fromJavaScript(jsResponse);
+ return response;
+
+ } catch ( Exception e ) {
+ throw new RuntimeException(e);
+ }
+ finally {
+ Context.exit();
+ }
+ }
+
+ protected Object[] toJavaScript(Object[] arg, Scriptable scope, Context cx) throws RuntimeException {
+ Object[] jsArgs;
+ if (arg == null) {
+ jsArgs = new Object[0];
+ } else if (arg.length == 1 && arg[0] instanceof OMElement) {
+ try {
+ XmlObject xmlObject = XmlObject.Factory.parse(arg[0].toString());
+ Object jsXML = cx.getWrapFactory().wrap(cx, scope, xmlObject, XmlObject.class);
+ jsArgs = new Object[] { cx.newObject(scope, "XML", new Object[] { jsXML }) };
+ } catch ( Exception e ) {
+ throw new RuntimeException(e);
+ }
+ } else if (arg.length == 1 && arg[0] instanceof XmlObject) {
+ Object jsXML = cx.getWrapFactory().wrap(cx, scope, (XmlObject)arg[0], XmlObject.class);
+ jsArgs = new Object[] { cx.newObject(scope, "XML", new Object[] { jsXML }) };
+ } else {
+ jsArgs = new Object[arg.length];
+ for (int i = 0; i < jsArgs.length; i++) {
+ jsArgs[i] = Context.toObject(arg[i], scope);
+ }
+ }
+
+ return jsArgs;
+ }
+
+ protected Object fromJavaScript(Object o) throws Exception {
+ Object response;
+ if (Context.getUndefinedValue().equals(o)) {
+ response = null;
+ } else if (o instanceof XMLObject) {
+ // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
+ Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) o, "copy", new Object[0]);
+ Wrapper wrapper = (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]);
+ response = wrapper.unwrap();
+
+ XMLStreamReader xmlReader =
+ StAXUtils.createXMLStreamReader(new ByteArrayInputStream(response.toString().getBytes()));
+ StAXOMBuilder staxOMBuilder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlReader);
+ response = staxOMBuilder.getDocumentElement();
+
+ } else if (o instanceof Wrapper) {
+ response = ((Wrapper) o).unwrap();
+ } else {
+ if (responseClass != null) {
+ response = Context.jsToJava(o, responseClass);
+ } else {
+ response = Context.jsToJava(o, String.class);
+ }
+ }
+ return response;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfig.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfig.java
new file mode 100644
index 0000000000..cb1a5c056c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfig.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Scope;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.UniqueTag;
+
+/**
+ * Represents the variable defining the SCA aspects of the script
+ * <code>
+ * SCA = {
+ * javaInterface : "my.pkg.ClassName",
+ * wsdlPortType : "wsdlPortTypeName",
+ * wsdlNameSpace : "http://my.namespace.com",
+ * wsdlLocation : "\wsdl\mywsdl.txt",
+ * properties : { "foo" : ["java.lang.String", "defaultValue"],},
+ * references : {},
+ * scope : 'stateless'|'request'|'conversational'|'composite',
+ * }
+ * </code>
+ * The config must define the service with either javaInterface or wsdl. When
+ * using wsdl the three parameters are optional. If wsdlLocation is used that is the
+ * WSDL document used, and the namespace and portType parameters are only required if
+ * the WSDL definition defines multiple portTypes.
+ */
+public class RhinoSCAConfig {
+
+ private boolean hasSCAConfig;
+
+ private String javaInterface;
+
+ private String wsdlLocation;
+
+ private String wsdlNamespace;
+
+ private String wsdlPortType;
+
+ private Map properties;
+
+ private Map references;
+
+ private Scope scope;
+
+ public RhinoSCAConfig(Scriptable scriptScope) {
+ Object o = scriptScope.get("SCA", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ hasSCAConfig = true;
+ Scriptable scaVar = (Scriptable) o;
+ o = scaVar.get("javaInterface", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ this.javaInterface = o.toString();
+ }
+ o = scaVar.get("wsdlLocation", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ this.wsdlLocation = o.toString();
+ }
+ o = scaVar.get("wsdlPortType", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ this.wsdlPortType = o.toString();
+ }
+ o = scaVar.get("wsdlNamespace", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ this.wsdlNamespace = o.toString();
+ }
+ if (javaInterface != null) {
+ if (wsdlLocation != null || wsdlPortType != null || wsdlNamespace != null) {
+ throw new IllegalArgumentException("script SCA config defines both Java and WSDL service interface");
+ }
+ } else {
+ if (wsdlLocation == null && wsdlPortType == null && wsdlNamespace == null) {
+ throw new IllegalArgumentException("script SCA config must define either Java or WSDL service interface");
+ }
+ }
+
+ this.properties = new HashMap();
+ o = scaVar.get("properties", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ // TODO parse properties
+ }
+
+ this.references = new HashMap();
+ o = scaVar.get("references", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ // TODO parse references
+ }
+
+ o = scaVar.get("scope", scriptScope);
+ if (o != null && UniqueTag.NOT_FOUND != o) {
+ if ("stateless".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.STATELESS;
+ } else if ("request".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.REQUEST;
+ } else if ("conversational".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.SESSION; // TODO: where's CONVERSATION?
+ } else if ("composite".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.COMPOSITE; // TODO: composite = MODULE for now?
+ } else {
+ throw new IllegalArgumentException("invalid scope value: " + o);
+ }
+ }
+
+ }
+ }
+
+ public boolean hasSCAConfig() {
+ return hasSCAConfig;
+ }
+
+ public String getJavaInterface() {
+ return javaInterface;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ public Map getReferences() {
+ return references;
+ }
+
+ public String getWSDLLocation() {
+ return wsdlLocation;
+ }
+
+ public String getWSDLNamespace() {
+ return wsdlNamespace;
+ }
+
+ public String getWSDLPortType() {
+ return wsdlPortType;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java
new file mode 100644
index 0000000000..3552372223
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
+import org.mozilla.javascript.ImporterTopLevel;
+import org.mozilla.javascript.Script;
+import org.mozilla.javascript.Scriptable;
+
+/**
+ * A RhinoScript represents a compiled JavaScript script
+ */
+public class RhinoScript {
+
+ protected String scriptName;
+
+ protected String script;
+
+ protected Scriptable scriptScope;
+
+ protected Map<String, Class> responseClasses;
+
+ protected ClassLoader classLoader;
+
+ /*
+ * Enable dynamic scopes so a script can be used concurrently with a global shared scope and individual execution scopes. See
+ * http://www.mozilla.org/rhino/scopes.html
+ */
+ private static class MyFactory extends ContextFactory {
+ protected boolean hasFeature(Context cx, int featureIndex) {
+ if (featureIndex == Context.FEATURE_DYNAMIC_SCOPE) {
+ return true;
+ }
+ return super.hasFeature(cx, featureIndex);
+ }
+ }
+
+ static {
+ ContextFactory.initGlobal(new MyFactory());
+ }
+
+ /**
+ * Create a new RhinoScript.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ */
+ public RhinoScript(String scriptName, String script) {
+ this(scriptName, script, (Map) null, null);
+ }
+
+ /**
+ * Create a new RhinoInvoker.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ * @param context
+ * name-value pairs that are added in to the scope where the script is compiled. May be null. The value objects are made available to
+ * the script by using a variable with the name.
+ * @param classLoader
+ * the ClassLoader Rhino should use to locate any user Java classes used in the script
+ */
+ public RhinoScript(String scriptName, String script, Map context, ClassLoader classLoader) {
+ this.scriptName = scriptName;
+ this.script = script;
+ this.responseClasses = new HashMap<String, Class>();
+ this.classLoader = classLoader;
+ initScriptScope(scriptName, script, context, classLoader);
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ *
+ * @return a RhinoScriptInstance
+ */
+ public RhinoScriptInstance createRhinoScriptInstance() {
+ return createRhinoScriptInstance(null);
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ *
+ * @param context
+ * objects to add to scope of the script instance
+ * @return a RhinoScriptInstance
+ */
+ public RhinoScriptInstance createRhinoScriptInstance(Map<String, Object> context) {
+ Scriptable instanceScope = createInstanceScope(context);
+ RhinoScriptInstance rsi = new RhinoScriptInstance(scriptScope, instanceScope, context, responseClasses);
+ return rsi;
+ }
+
+ /**
+ * Initialize the Rhino Scope for this script instance
+ */
+ public Scriptable createInstanceScope(Map<String, Object> context) {
+ Context cx = Context.enter();
+ try {
+
+ Scriptable instanceScope = cx.newObject(scriptScope);
+ instanceScope.setPrototype(scriptScope);
+ instanceScope.setParentScope(null);
+
+ addContexts(instanceScope, context);
+
+ return instanceScope;
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ /**
+ * Create a Rhino scope and compile the script into it
+ */
+ public void initScriptScope(String fileName, String scriptCode, Map context, ClassLoader cl) {
+ Context cx = Context.enter();
+ try {
+ if (cl != null) {
+ // TODO: broken with the way the tuscany launcher now uses class loaders
+ // cx.setApplicationClassLoader(cl);
+ }
+ this.scriptScope = new ImporterTopLevel(cx, true);
+ Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
+ compiledScript.exec(cx, scriptScope);
+ addContexts(scriptScope, context);
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ /**
+ * Add the context to the scope. This will make the objects available to a script by using the name it was added with.
+ */
+ protected void addContexts(Scriptable scope, Map contexts) {
+ if (contexts != null) {
+ for (Iterator i = contexts.keySet().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ Object value = contexts.get(name);
+ if (value != null) {
+ scope.put(name, scope, Context.toObject(value, scope));
+ }
+ }
+ }
+ }
+
+ public String getScript() {
+ return script;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public Scriptable getScriptScope() {
+ return scriptScope;
+ }
+
+ public Map<String, Class> getResponseClasses() {
+ return responseClasses;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ /**
+ * Set the Java type of a response value. JavaScript is dynamically typed so Rhino cannot always work out what the intended Java type of a
+ * response should be, for example should the statement "return 42" be a Java int, or Integer or Double etc. When Rhino can't determine the type
+ * it will default to returning a String, using this method enables overriding the Rhino default to use a specific Java type.
+ */
+ public void setResponseClass(String functionName, Class responseClasses) {
+ this.responseClasses.put(functionName, responseClasses);
+ }
+
+ public RhinoSCAConfig getSCAConfig() {
+ return new RhinoSCAConfig(getScriptScope());
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java
new file mode 100644
index 0000000000..f368a453d3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Function;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.UniqueTag;
+
+/**
+ * An invokeable instance of a JavaScript script.
+ */
+public class RhinoScriptInstance {
+
+ private Scriptable scriptScope;
+
+ private Scriptable instanceScope;
+
+ private Map<String, Class> responseClasses;
+
+ public RhinoScriptInstance(Scriptable scriptScope, Scriptable instanceScope, Map<String, Object> context, Map<String, Class> responseClasses) {
+ this.scriptScope = scriptScope;
+ this.instanceScope = instanceScope;
+ this.responseClasses = responseClasses;
+ if (this.responseClasses == null) {
+ this.responseClasses = new HashMap<String, Class>();
+ }
+ addContexts(instanceScope, context);
+ }
+
+ public Object invokeFunction(String functionName, Object[] args) {
+ return invokeFunction(functionName, args, null);
+ }
+
+ public Object invokeFunction(String functionName, Object[] args, Class respClass) {
+ RhinoFunctionInvoker invoker = createRhinoFunctionInvoker(functionName, respClass);
+ return invoker.invoke(args);
+ }
+
+ public RhinoFunctionInvoker createRhinoFunctionInvoker(String functionName) {
+ return createRhinoFunctionInvoker(functionName, null);
+ }
+
+
+ public RhinoFunctionInvoker createRhinoFunctionInvoker(String functionName, Class responseClass) {
+ Function function = getFunction(functionName);
+ //Class responseClass = responseClasses.get(functionName);
+ RhinoFunctionInvoker invoker = new RhinoFunctionInvoker(instanceScope, function, responseClass);
+ return invoker;
+ }
+
+ /**
+ * Add the context to the scope. This will make the objects available to a script by using the name it was added with.
+ */
+ protected void addContexts(Scriptable scope, Map contexts) {
+ if (contexts != null) {
+ Context.enter();
+ try {
+ for (Iterator i = contexts.keySet().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ Object value = contexts.get(name);
+ if (value != null) {
+ scope.put(name, scope, Context.toObject(value, scope));
+ }
+ }
+ } finally {
+ Context.exit();
+ }
+ }
+ }
+
+ /**
+ * Get the Rhino Function object for the named script function
+ */
+ protected Function getFunction(String functionName) {
+
+ Object handleObj = scriptScope.get(functionName, instanceScope);
+ if (UniqueTag.NOT_FOUND.equals(handleObj)) {
+ // Bit of a hack so E4X scripts don't need to define a function for every operation
+ handleObj = scriptScope.get("process", instanceScope);
+ }
+ if (!(handleObj instanceof Function)) {
+ throw new RuntimeException("script function '" + functionName + "' is undefined or not a function");
+ }
+
+ return (Function) handleObj;
+ }
+
+}
+
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsHandler.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsHandler.java
new file mode 100644
index 0000000000..b724b33ac3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsHandler.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+/**
+ * This interface is to be implemented by classes that wish to
+ * handle commandline arguments.
+ *
+ */
+public interface CmdLineArgsHandler {
+ public void handleArgument(String optionFlag, String argValue) throws IllegalArgumentException;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsProcessor.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsProcessor.java
new file mode 100644
index 0000000000..914f1d03f2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/CmdLineArgsProcessor.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+/**
+ * This class provides a generic command line arguments processing utility. The processArgs
+ * method of this class processes the command line arguments that could contain option flags,
+ * options and values and calls a ArgumentHanlder instance for handling the agruments.
+ *
+ */
+public class CmdLineArgsProcessor {
+ private String printUsageMessage = "No hints available on Usage!";
+
+ private CmdLineArgsHandler argsHandler = null;
+
+ public static final String HYPEN = "-";
+
+ public void processArgs(String[] args) {
+ try {
+ if (args.length == 0) {
+ printUsage();
+ } else {
+ parseAndHandleArgs(args);
+ }
+ } catch (Exception e) {
+ System.out.println("Exception in processing argument - " + e);
+ printUsage();
+ }
+
+ }
+
+ public void parseAndHandleArgs(String[] args) throws Exception {
+ int index = 0;
+ while (index < args.length - 1) {
+ if (args[index].startsWith(HYPEN) && !args[index + 1].startsWith(HYPEN)) {
+ argsHandler.handleArgument(args[index].substring(1), args[index + 1]);
+ index = index + 2;
+ } else {
+ throw new IllegalArgumentException("Wrong Usage of options!");
+ }
+ }
+ }
+
+ protected void printUsage() {
+
+ }
+
+ public CmdLineArgsHandler getArgsHandler() {
+ return argsHandler;
+ }
+
+ public void setArgsHandler(CmdLineArgsHandler argsHandler) {
+ this.argsHandler = argsHandler;
+ }
+
+ public String getPrintUsageMessage() {
+ return printUsageMessage;
+ }
+
+ public void setPrintUsageMessage(String printUsageMessage) {
+ this.printUsageMessage = printUsageMessage;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/TuscanySampleXmlUtil.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/TuscanySampleXmlUtil.java
new file mode 100644
index 0000000000..98de8fc0a7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/TuscanySampleXmlUtil.java
@@ -0,0 +1,1097 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.GDurationBuilder;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDateBuilder;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.XmlDate;
+import org.apache.xmlbeans.XmlDateTime;
+import org.apache.xmlbeans.XmlTime;
+import org.apache.xmlbeans.XmlGYear;
+import org.apache.xmlbeans.XmlGYearMonth;
+import org.apache.xmlbeans.XmlGMonth;
+import org.apache.xmlbeans.XmlGMonthDay;
+import org.apache.xmlbeans.XmlGDay;
+import org.apache.xmlbeans.XmlDecimal;
+import org.apache.xmlbeans.XmlDuration;
+import org.apache.xmlbeans.soap.SchemaWSDLArrayType;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.impl.util.Base64;
+import org.apache.xmlbeans.impl.util.HexBin;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Random;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class is a replication of the XMLBeans SampleXMLutil class. This replication
+ * is required to overide the XMLBeans behaviour of this class in certain places. Since
+ * most methods of the XMLBeans implementation of this class is private, no overiding
+ * has been possible using inheritance. Hence this replication.
+ *
+ */
+public class TuscanySampleXmlUtil {
+ private static final String BLANK_STRING = " ";
+
+ private boolean generate_sample_data = false;
+
+ private boolean _soapEnc;
+
+ private static final int MAX_ELEMENTS = 1000;
+
+ private int _nElements;
+
+ boolean flag = true;
+
+ private TuscanySampleXmlUtil(boolean soapEnc) {
+ _soapEnc = soapEnc;
+ }
+
+ public TuscanySampleXmlUtil() {
+ this(false);
+ }
+
+ public String createSampleForType(SchemaType sType) {
+ XmlObject object = XmlObject.Factory.newInstance();
+ XmlCursor cursor = object.newCursor();
+ // Skip the document node
+ cursor.toNextToken();
+ // Using the type and the cursor, call the utility method to get a
+ // sample XML payload for that Schema element
+ createSampleForType(sType, cursor);
+ // Cursor now contains the sample payload
+ // Pretty print the result. Note that the cursor is positioned at the
+ // end of the doc so we use the original xml object that the cursor was
+ // created upon to do the xmlText() against.
+ XmlOptions options = new XmlOptions();
+ options.put(XmlOptions.SAVE_PRETTY_PRINT);
+ options.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, 2);
+ options.put(XmlOptions.SAVE_AGGRESSIVE_NAMESPACES);
+ String result = object.xmlText(options);
+ return result;
+ }
+
+ Random _picker = new Random(1);
+
+ /**
+ * Cursor position
+ * Before:
+ * <theElement>^</theElement>
+ * After:
+ * <theElement><lots of stuff/>^</theElement>
+ */
+ private void createSampleForType(SchemaType stype, XmlCursor xmlc) {
+ if (_typeStack.contains(stype))
+ //if ( !flag )
+ return;
+ //else
+ // flag = false;
+
+ _typeStack.add(stype);
+
+ try {
+ if (stype.isSimpleType() || stype.isURType()) {
+ processSimpleType(stype, xmlc);
+ return;
+ }
+
+ // complex Type
+ // <theElement>^</theElement>
+ processAttributes(stype, xmlc);
+
+ // <theElement attri1="string">^</theElement>
+ switch (stype.getContentType()) {
+ case SchemaType.NOT_COMPLEX_TYPE:
+ case SchemaType.EMPTY_CONTENT:
+ // noop
+ break;
+ case SchemaType.SIMPLE_CONTENT: {
+ processSimpleType(stype, xmlc);
+ }
+ break;
+ case SchemaType.MIXED_CONTENT:
+ if (isGenerate_sample_data())
+ xmlc.insertChars(pick(WORDS) + " ");
+ if (stype.getContentModel() != null) {
+ processParticle(stype.getContentModel(), xmlc, true);
+ }
+ if (isGenerate_sample_data())
+ xmlc.insertChars(pick(WORDS));
+
+ break;
+ case SchemaType.ELEMENT_CONTENT:
+ if (stype.getContentModel() != null) {
+ processParticle(stype.getContentModel(), xmlc, false);
+ }
+ break;
+ }
+ } finally {
+ _typeStack.remove(_typeStack.size() - 1);
+ }
+ }
+
+ private void processSimpleType(SchemaType stype, XmlCursor xmlc) {
+ String sample = sampleDataForSimpleType(stype);
+ xmlc.insertChars(sample);
+
+ }
+
+ private String sampleDataForSimpleType(SchemaType sType) {
+ if (isGenerate_sample_data()) {
+ return generateSampleDataForSimpleType(sType);
+ } else {
+ return BLANK_STRING;
+ }
+ }
+
+ private String generateSampleDataForSimpleType(SchemaType sType) {
+ if (XmlObject.type.equals(sType))
+ return "anyType";
+
+ if (XmlAnySimpleType.type.equals(sType))
+ return "anySimpleType";
+
+ if (sType.getSimpleVariety() == SchemaType.LIST) {
+ SchemaType itemType = sType.getListItemType();
+ StringBuffer sb = new StringBuffer();
+ int length = pickLength(sType);
+ if (length > 0)
+ sb.append(sampleDataForSimpleType(itemType));
+ for (int i = 1; i < length; i += 1) {
+ sb.append(' ');
+ sb.append(sampleDataForSimpleType(itemType));
+ }
+ return sb.toString();
+ }
+
+ if (sType.getSimpleVariety() == SchemaType.UNION) {
+ SchemaType[] possibleTypes = sType.getUnionConstituentTypes();
+ if (possibleTypes.length == 0)
+ return "";
+ return sampleDataForSimpleType(possibleTypes[pick(possibleTypes.length)]);
+ }
+
+ XmlAnySimpleType[] enumValues = sType.getEnumerationValues();
+ if (enumValues != null && enumValues.length > 0) {
+ return enumValues[pick(enumValues.length)].getStringValue();
+ }
+
+ switch (sType.getPrimitiveType().getBuiltinTypeCode()) {
+ default:
+ case SchemaType.BTC_NOT_BUILTIN:
+ return "";
+
+ case SchemaType.BTC_ANY_TYPE:
+ case SchemaType.BTC_ANY_SIMPLE:
+ return "anything";
+
+ case SchemaType.BTC_BOOLEAN:
+ return pick(2) == 0 ? "true" : "false";
+
+ case SchemaType.BTC_BASE_64_BINARY: {
+ String result = null;
+ try {
+ result = new String(Base64.encode(formatToLength(pick(WORDS), sType).getBytes("utf-8")));
+ } catch (java.io.UnsupportedEncodingException e) { /* Can't possibly happen */
+ }
+ return result;
+ }
+
+ case SchemaType.BTC_HEX_BINARY:
+ return HexBin.encode(formatToLength(pick(WORDS), sType));
+
+ case SchemaType.BTC_ANY_URI:
+ return formatToLength("http://www." + pick(DNS1) + "." + pick(DNS2) + "/" + pick(WORDS) + "/" + pick(WORDS), sType);
+
+ case SchemaType.BTC_QNAME:
+ return formatToLength("qname", sType);
+
+ case SchemaType.BTC_NOTATION:
+ return formatToLength("notation", sType);
+
+ case SchemaType.BTC_FLOAT:
+ return "1.5E2";
+ case SchemaType.BTC_DOUBLE:
+ return "1.051732E7";
+ case SchemaType.BTC_DECIMAL:
+ switch (closestBuiltin(sType).getBuiltinTypeCode()) {
+ case SchemaType.BTC_SHORT:
+ return formatDecimal("1", sType);
+ case SchemaType.BTC_UNSIGNED_SHORT:
+ return formatDecimal("5", sType);
+ case SchemaType.BTC_BYTE:
+ return formatDecimal("2", sType);
+ case SchemaType.BTC_UNSIGNED_BYTE:
+ return formatDecimal("6", sType);
+ case SchemaType.BTC_INT:
+ return formatDecimal("3", sType);
+ case SchemaType.BTC_UNSIGNED_INT:
+ return formatDecimal("7", sType);
+ case SchemaType.BTC_LONG:
+ return formatDecimal("10", sType);
+ case SchemaType.BTC_UNSIGNED_LONG:
+ return formatDecimal("11", sType);
+ case SchemaType.BTC_INTEGER:
+ return formatDecimal("100", sType);
+ case SchemaType.BTC_NON_POSITIVE_INTEGER:
+ return formatDecimal("-200", sType);
+ case SchemaType.BTC_NEGATIVE_INTEGER:
+ return formatDecimal("-201", sType);
+ case SchemaType.BTC_NON_NEGATIVE_INTEGER:
+ return formatDecimal("200", sType);
+ case SchemaType.BTC_POSITIVE_INTEGER:
+ return formatDecimal("201", sType);
+ default:
+ case SchemaType.BTC_DECIMAL:
+ return formatDecimal("1000.00", sType);
+ }
+
+ case SchemaType.BTC_STRING: {
+ String result;
+ switch (closestBuiltin(sType).getBuiltinTypeCode()) {
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_NORMALIZED_STRING:
+ result = "string";
+ break;
+
+ case SchemaType.BTC_TOKEN:
+ result = "token";
+ break;
+
+ default:
+ result = "string";
+ break;
+ }
+
+ return formatToLength(result, sType);
+ }
+
+ case SchemaType.BTC_DURATION:
+ return formatDuration(sType);
+
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ return formatDate(sType);
+ }
+ }
+
+ // a bit from the Aenid
+ public static final String[] WORDS = new String[] { "ipsa", "iovis", "rapidum", "iaculata", "e", "nubibus", "ignem", "disiecitque", "rates",
+ "evertitque", "aequora", "ventis", "illum", "exspirantem", "transfixo", "pectore", "flammas", "turbine", "corripuit", "scopuloque",
+ "infixit", "acuto", "ast", "ego", "quae", "divum", "incedo", "regina", "iovisque", "et", "soror", "et", "coniunx", "una", "cum", "gente",
+ "tot", "annos", "bella", "gero", "et", "quisquam", "numen", "iunonis", "adorat", "praeterea", "aut", "supplex", "aris", "imponet",
+ "honorem", "talia", "flammato", "secum", "dea", "corde", "volutans", "nimborum", "in", "patriam", "loca", "feta", "furentibus",
+ "austris", "aeoliam", "venit", "hic", "vasto", "rex", "aeolus", "antro", "luctantis", "ventos", "tempestatesque", "sonoras", "imperio",
+ "premit", "ac", "vinclis", "et", "carcere", "frenat", "illi", "indignantes", "magno", "cum", "murmure", "montis", "circum", "claustra",
+ "fremunt", "celsa", "sedet", "aeolus", "arce", "sceptra", "tenens", "mollitque", "animos", "et", "temperat", "iras", "ni", "faciat",
+ "maria", "ac", "terras", "caelumque", "profundum", "quippe", "ferant", "rapidi", "secum", "verrantque", "per", "auras", "sed", "pater",
+ "omnipotens", "speluncis", "abdidit", "atris", "hoc", "metuens", "molemque", "et", "montis", "insuper", "altos", "imposuit", "regemque",
+ "dedit", "qui", "foedere", "certo", "et", "premere", "et", "laxas", "sciret", "dare", "iussus", "habenas", };
+
+ private static final String[] DNS1 = new String[] { "corp", "your", "my", "sample", "company", "test", "any" };
+
+ private static final String[] DNS2 = new String[] { "com", "org", "com", "gov", "org", "com", "org", "com", "edu" };
+
+ private int pick(int n) {
+ return _picker.nextInt(n);
+ }
+
+ private String pick(String[] a) {
+ return a[pick(a.length)];
+ }
+
+ private String pick(String[] a, int count) {
+ if (count <= 0)
+ return "";
+
+ int i = pick(a.length);
+ StringBuffer sb = new StringBuffer(a[i]);
+ while (count-- > 0) {
+ i += 1;
+ if (i >= a.length)
+ i = 0;
+ sb.append(' ');
+ sb.append(a[i]);
+ }
+ return sb.toString();
+ }
+
+ private String pickDigits(int digits) {
+ StringBuffer sb = new StringBuffer();
+ while (digits-- > 0)
+ sb.append(Integer.toString(pick(10)));
+ return sb.toString();
+ }
+
+ private int pickLength(SchemaType sType) {
+ XmlInteger length = (XmlInteger) sType.getFacet(SchemaType.FACET_LENGTH);
+ if (length != null)
+ return length.getBigIntegerValue().intValue();
+ XmlInteger min = (XmlInteger) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
+ XmlInteger max = (XmlInteger) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
+ int minInt, maxInt;
+ if (min == null)
+ minInt = 0;
+ else
+ minInt = min.getBigIntegerValue().intValue();
+ if (max == null)
+ maxInt = Integer.MAX_VALUE;
+ else
+ maxInt = max.getBigIntegerValue().intValue();
+ // We try to keep the length of the array within reasonable limits,
+ // at least 1 item and at most 3 if possible
+ if (minInt == 0 && maxInt >= 1)
+ minInt = 1;
+ if (maxInt > minInt + 2)
+ maxInt = minInt + 2;
+ if (maxInt < minInt)
+ maxInt = minInt;
+ return minInt + pick(maxInt - minInt);
+ }
+
+ /**
+ * Formats a given string to the required length, using the following operations:
+ * - append the source string to itself as necessary to pass the minLength;
+ * - truncate the result of previous step, if necessary, to keep it within minLength.
+ */
+ private String formatToLength(String s, SchemaType sType) {
+ String result = s;
+ try {
+ SimpleValue min = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
+ if (min == null)
+ min = (SimpleValue) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
+ if (min != null) {
+ int len = min.getIntValue();
+ while (result.length() < len)
+ result = result + result;
+ }
+ SimpleValue max = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
+ if (max == null)
+ max = (SimpleValue) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
+ if (max != null) {
+ int len = max.getIntValue();
+ if (result.length() > len)
+ result = result.substring(0, len);
+ }
+ } catch (Exception e) // intValue can be out of range
+ {
+ }
+ return result;
+ }
+
+ private String formatDecimal(String start, SchemaType sType) {
+ BigDecimal result = new BigDecimal(start);
+ XmlDecimal xmlD;
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ BigDecimal min = xmlD != null ? xmlD.getBigDecimalValue() : null;
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ BigDecimal max = xmlD != null ? xmlD.getBigDecimalValue() : null;
+ boolean minInclusive = true, maxInclusive = true;
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (xmlD != null) {
+ BigDecimal minExcl = xmlD.getBigDecimalValue();
+ if (min == null || min.compareTo(minExcl) < 0) {
+ min = minExcl;
+ minInclusive = false;
+ }
+ }
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (xmlD != null) {
+ BigDecimal maxExcl = xmlD.getBigDecimalValue();
+ if (max == null || max.compareTo(maxExcl) > 0) {
+ max = maxExcl;
+ maxInclusive = false;
+ }
+ }
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_TOTAL_DIGITS);
+ int totalDigits = -1;
+ if (xmlD != null) {
+ totalDigits = xmlD.getBigDecimalValue().intValue();
+
+ StringBuffer sb = new StringBuffer(totalDigits);
+ for (int i = 0; i < totalDigits; i++)
+ sb.append('9');
+ BigDecimal digitsLimit = new BigDecimal(sb.toString());
+ if (max != null && max.compareTo(digitsLimit) > 0) {
+ max = digitsLimit;
+ maxInclusive = true;
+ }
+ digitsLimit = digitsLimit.negate();
+ if (min != null && min.compareTo(digitsLimit) < 0) {
+ min = digitsLimit;
+ minInclusive = true;
+ }
+ }
+
+ int sigMin = min == null ? 1 : result.compareTo(min);
+ int sigMax = max == null ? -1 : result.compareTo(max);
+ boolean minOk = sigMin > 0 || sigMin == 0 && minInclusive;
+ boolean maxOk = sigMax < 0 || sigMax == 0 && maxInclusive;
+
+ // Compute the minimum increment
+ xmlD = (XmlDecimal) sType.getFacet(SchemaType.FACET_FRACTION_DIGITS);
+ int fractionDigits = -1;
+ BigDecimal increment;
+ if (xmlD == null)
+ increment = new BigDecimal(1);
+ else {
+ fractionDigits = xmlD.getBigDecimalValue().intValue();
+ if (fractionDigits > 0) {
+ StringBuffer sb = new StringBuffer("0.");
+ for (int i = 1; i < fractionDigits; i++)
+ sb.append('0');
+ sb.append('1');
+ increment = new BigDecimal(sb.toString());
+ } else
+ increment = new BigDecimal(1.0);
+ }
+
+ if (minOk && maxOk) {
+ // OK
+ } else if (minOk && !maxOk) {
+ // TOO BIG
+ if (maxInclusive)
+ result = max;
+ else
+ result = max.subtract(increment);
+ } else if (!minOk && maxOk) {
+ // TOO SMALL
+ if (minInclusive)
+ result = min;
+ else
+ result = min.add(increment);
+ } else {
+ // MIN > MAX!!
+ }
+
+ // We have the number
+ // Adjust the scale according to the totalDigits and fractionDigits
+ int digits = 0;
+ BigDecimal ONE = new BigDecimal(BigInteger.ONE);
+ for (BigDecimal n = result; n.abs().compareTo(ONE) >= 0; digits++)
+ n = n.movePointLeft(1);
+
+ if (fractionDigits > 0)
+ if (totalDigits >= 0)
+ result.setScale(Math.max(fractionDigits, totalDigits - digits));
+ else
+ result.setScale(fractionDigits);
+ else if (fractionDigits == 0)
+ result.setScale(0);
+
+ return result.toString();
+ }
+
+ private String formatDuration(SchemaType sType) {
+ XmlDuration d = (XmlDuration) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ GDuration minInclusive = null;
+ if (d != null)
+ minInclusive = d.getGDurationValue();
+
+ d = (XmlDuration) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ GDuration maxInclusive = null;
+ if (d != null)
+ maxInclusive = d.getGDurationValue();
+
+ d = (XmlDuration) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ GDuration minExclusive = null;
+ if (d != null)
+ minExclusive = d.getGDurationValue();
+
+ d = (XmlDuration) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ GDuration maxExclusive = null;
+ if (d != null)
+ maxExclusive = d.getGDurationValue();
+
+ GDurationBuilder gdurb = new GDurationBuilder();
+ BigInteger min, max;
+
+ gdurb.setSecond(pick(800000));
+ gdurb.setMonth(pick(20));
+
+ // Years
+ // Months
+ // Days
+ // Hours
+ // Minutes
+ // Seconds
+ // Fractions
+ if (minInclusive != null) {
+ if (gdurb.getYear() < minInclusive.getYear())
+ gdurb.setYear(minInclusive.getYear());
+ if (gdurb.getMonth() < minInclusive.getMonth())
+ gdurb.setMonth(minInclusive.getMonth());
+ if (gdurb.getDay() < minInclusive.getDay())
+ gdurb.setDay(minInclusive.getDay());
+ if (gdurb.getHour() < minInclusive.getHour())
+ gdurb.setHour(minInclusive.getHour());
+ if (gdurb.getMinute() < minInclusive.getMinute())
+ gdurb.setMinute(minInclusive.getMinute());
+ if (gdurb.getSecond() < minInclusive.getSecond())
+ gdurb.setSecond(minInclusive.getSecond());
+ if (gdurb.getFraction().compareTo(minInclusive.getFraction()) < 0)
+ gdurb.setFraction(minInclusive.getFraction());
+ }
+
+ if (maxInclusive != null) {
+ if (gdurb.getYear() > maxInclusive.getYear())
+ gdurb.setYear(maxInclusive.getYear());
+ if (gdurb.getMonth() > maxInclusive.getMonth())
+ gdurb.setMonth(maxInclusive.getMonth());
+ if (gdurb.getDay() > maxInclusive.getDay())
+ gdurb.setDay(maxInclusive.getDay());
+ if (gdurb.getHour() > maxInclusive.getHour())
+ gdurb.setHour(maxInclusive.getHour());
+ if (gdurb.getMinute() > maxInclusive.getMinute())
+ gdurb.setMinute(maxInclusive.getMinute());
+ if (gdurb.getSecond() > maxInclusive.getSecond())
+ gdurb.setSecond(maxInclusive.getSecond());
+ if (gdurb.getFraction().compareTo(maxInclusive.getFraction()) > 0)
+ gdurb.setFraction(maxInclusive.getFraction());
+ }
+
+ if (minExclusive != null) {
+ if (gdurb.getYear() <= minExclusive.getYear())
+ gdurb.setYear(minExclusive.getYear() + 1);
+ if (gdurb.getMonth() <= minExclusive.getMonth())
+ gdurb.setMonth(minExclusive.getMonth() + 1);
+ if (gdurb.getDay() <= minExclusive.getDay())
+ gdurb.setDay(minExclusive.getDay() + 1);
+ if (gdurb.getHour() <= minExclusive.getHour())
+ gdurb.setHour(minExclusive.getHour() + 1);
+ if (gdurb.getMinute() <= minExclusive.getMinute())
+ gdurb.setMinute(minExclusive.getMinute() + 1);
+ if (gdurb.getSecond() <= minExclusive.getSecond())
+ gdurb.setSecond(minExclusive.getSecond() + 1);
+ if (gdurb.getFraction().compareTo(minExclusive.getFraction()) <= 0)
+ gdurb.setFraction(minExclusive.getFraction().add(new BigDecimal(0.001)));
+ }
+
+ if (maxExclusive != null) {
+ if (gdurb.getYear() > maxExclusive.getYear())
+ gdurb.setYear(maxExclusive.getYear());
+ if (gdurb.getMonth() > maxExclusive.getMonth())
+ gdurb.setMonth(maxExclusive.getMonth());
+ if (gdurb.getDay() > maxExclusive.getDay())
+ gdurb.setDay(maxExclusive.getDay());
+ if (gdurb.getHour() > maxExclusive.getHour())
+ gdurb.setHour(maxExclusive.getHour());
+ if (gdurb.getMinute() > maxExclusive.getMinute())
+ gdurb.setMinute(maxExclusive.getMinute());
+ if (gdurb.getSecond() > maxExclusive.getSecond())
+ gdurb.setSecond(maxExclusive.getSecond());
+ if (gdurb.getFraction().compareTo(maxExclusive.getFraction()) > 0)
+ gdurb.setFraction(maxExclusive.getFraction());
+ }
+
+ gdurb.normalize();
+ return gdurb.toString();
+ }
+
+ private String formatDate(SchemaType sType) {
+ GDateBuilder gdateb = new GDateBuilder(new Date(1000L * pick(365 * 24 * 60 * 60) + (30L + pick(20)) * 365 * 24 * 60 * 60 * 1000));
+ GDate min = null, max = null;
+ GDate temp;
+
+ // Find the min and the max according to the type
+ switch (sType.getPrimitiveType().getBuiltinTypeCode()) {
+ case SchemaType.BTC_DATE_TIME: {
+ XmlDateTime x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_TIME: {
+ XmlTime x = (XmlTime) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlTime) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlTime) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlTime) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_DATE: {
+ XmlDate x = (XmlDate) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlDate) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlDate) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlDate) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_G_YEAR_MONTH: {
+ XmlGYearMonth x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_G_YEAR: {
+ XmlGYear x = (XmlGYear) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlGYear) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlGYear) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlGYear) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_G_MONTH_DAY: {
+ XmlGMonthDay x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_G_DAY: {
+ XmlGDay x = (XmlGDay) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlGDay) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlGDay) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlGDay) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ case SchemaType.BTC_G_MONTH: {
+ XmlGMonth x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (x != null)
+ min = x.getGDateValue();
+ x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (x != null)
+ if (min == null || min.compareToGDate(x.getGDateValue()) <= 0)
+ min = x.getGDateValue();
+
+ x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (x != null)
+ max = x.getGDateValue();
+ x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (x != null)
+ if (max == null || max.compareToGDate(x.getGDateValue()) >= 0)
+ max = x.getGDateValue();
+ break;
+ }
+ }
+
+ if (min != null && max == null) {
+ if (min.compareToGDate(gdateb) >= 0) {
+ // Reset the date to min + (1-8) hours
+ Calendar c = gdateb.getCalendar();
+ c.add(Calendar.HOUR_OF_DAY, pick(8));
+ gdateb = new GDateBuilder(c);
+ }
+ } else if (min == null && max != null) {
+ if (max.compareToGDate(gdateb) <= 0) {
+ // Reset the date to max - (1-8) hours
+ Calendar c = gdateb.getCalendar();
+ c.add(Calendar.HOUR_OF_DAY, 0 - pick(8));
+ gdateb = new GDateBuilder(c);
+ }
+ } else if (min != null && max != null) {
+ if (min.compareToGDate(gdateb) >= 0 || max.compareToGDate(gdateb) <= 0) {
+ // Find a date between the two
+ Calendar c = min.getCalendar();
+ Calendar cmax = max.getCalendar();
+ c.add(Calendar.HOUR_OF_DAY, 1);
+ if (c.after(cmax)) {
+ c.add(Calendar.HOUR_OF_DAY, -1);
+ c.add(Calendar.MINUTE, 1);
+ if (c.after(cmax)) {
+ c.add(Calendar.MINUTE, -1);
+ c.add(Calendar.SECOND, 1);
+ if (c.after(cmax)) {
+ c.add(Calendar.SECOND, -1);
+ c.add(Calendar.MILLISECOND, 1);
+ if (c.after(cmax))
+ c.add(Calendar.MILLISECOND, -1);
+ }
+ }
+ }
+ gdateb = new GDateBuilder(c);
+ }
+ }
+
+ gdateb.setBuiltinTypeCode(sType.getPrimitiveType().getBuiltinTypeCode());
+ if (pick(2) == 0)
+ gdateb.clearTimeZone();
+ return gdateb.toString();
+ }
+
+ private SchemaType closestBuiltin(SchemaType sType) {
+ while (!sType.isBuiltinType())
+ sType = sType.getBaseType();
+ return sType;
+ }
+
+ /**
+ * Cracks a combined QName of the form URL:localname
+ */
+ public static QName crackQName(String qName) {
+ String ns;
+ String name;
+
+ int index = qName.lastIndexOf(':');
+ if (index >= 0) {
+ ns = qName.substring(0, index);
+ name = qName.substring(index + 1);
+ } else {
+ ns = "";
+ name = qName;
+ }
+
+ return new QName(ns, name);
+ }
+
+ /**
+ * Cursor position:
+ * Before this call:
+ * <outer><foo/>^</outer> (cursor at the ^)
+ * After this call:
+ * <<outer><foo/><bar/>som text<etc/>^</outer>
+ */
+ private void processParticle(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ int loop = determineMinMaxForSample(sp, xmlc);
+
+ while (loop-- > 0) {
+ switch (sp.getParticleType()) {
+ case (SchemaParticle.ELEMENT):
+ processElement(sp, xmlc, mixed);
+ break;
+ case (SchemaParticle.SEQUENCE):
+ processSequence(sp, xmlc, mixed);
+ break;
+ case (SchemaParticle.CHOICE):
+ processChoice(sp, xmlc, mixed);
+ break;
+ case (SchemaParticle.ALL):
+ processAll(sp, xmlc, mixed);
+ break;
+ case (SchemaParticle.WILDCARD):
+ processWildCard(sp, xmlc, mixed);
+ break;
+ default:
+ // throw new Exception("No Match on Schema Particle Type: " + String.valueOf(sp.getParticleType()));
+ }
+ }
+ }
+
+ private int determineMinMaxForSample(SchemaParticle sp, XmlCursor xmlc) {
+ int minOccurs = sp.getIntMinOccurs();
+ int maxOccurs = sp.getIntMaxOccurs();
+
+ if (minOccurs == maxOccurs)
+ return minOccurs;
+
+ int result = minOccurs;
+ if (result == 0 && _nElements < MAX_ELEMENTS)
+ result = 1;
+
+ if (sp.getParticleType() != SchemaParticle.ELEMENT)
+ return result;
+
+ // it probably only makes sense to put comments in front of individual elements that repeat
+
+ if (sp.getMaxOccurs() == null) {
+ // xmlc.insertComment("The next " + getItemNameOrType(sp, xmlc) + " may be repeated " + minOccurs + " or more times");
+ if (minOccurs == 0)
+ xmlc.insertComment("Zero or more repetitions:");
+ else
+ xmlc.insertComment(minOccurs + " or more repetitions:");
+ } else if (sp.getIntMaxOccurs() > 1) {
+ xmlc.insertComment(minOccurs + " to " + String.valueOf(sp.getMaxOccurs()) + " repetitions:");
+ } else {
+ xmlc.insertComment("Optional:");
+ }
+ return result;
+ }
+
+ /*
+ Return a name for the element or the particle type to use in the comment for minoccurs, max occurs
+ */
+ private String getItemNameOrType(SchemaParticle sp, XmlCursor xmlc) {
+ String elementOrTypeName = null;
+ if (sp.getParticleType() == SchemaParticle.ELEMENT) {
+ elementOrTypeName = "Element (" + sp.getName().getLocalPart() + ")";
+ } else {
+ elementOrTypeName = printParticleType(sp.getParticleType());
+ }
+ return elementOrTypeName;
+ }
+
+ private void processElement(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ // cast as schema local element
+ SchemaLocalElement element = (SchemaLocalElement) sp;
+ /// ^ -> <elemenname></elem>^
+ if (_soapEnc)
+ xmlc.insertElement(element.getName().getLocalPart()); // soap encoded? drop namespaces.
+ else
+ xmlc.insertElement(element.getName().getLocalPart(), element.getName().getNamespaceURI());
+ _nElements++;
+ /// -> <elem>^</elem>
+ xmlc.toPrevToken();
+ // -> <elem>stuff^</elem>
+ createSampleForType(element.getType(), xmlc);
+ // -> <elem>stuff</elem>^
+ xmlc.toNextToken();
+
+ }
+
+ private void moveToken(int numToMove, XmlCursor xmlc) {
+ for (int i = 0; i < Math.abs(numToMove); i++) {
+ if (numToMove < 0) {
+ xmlc.toPrevToken();
+ } else {
+ xmlc.toNextToken();
+ }
+ }
+ }
+
+ private static final String formatQName(XmlCursor xmlc, QName qName) {
+ XmlCursor parent = xmlc.newCursor();
+ parent.toParent();
+ String prefix = parent.prefixForNamespace(qName.getNamespaceURI());
+ parent.dispose();
+ String name;
+ if (prefix == null || prefix.length() == 0)
+ name = qName.getLocalPart();
+ else
+ name = prefix + ":" + qName.getLocalPart();
+ return name;
+ }
+
+ private static final QName HREF = new QName("href");
+
+ private static final QName ID = new QName("id");
+
+ private static final QName XSI_TYPE = new QName("http://www.w3.org/2001/XMLSchema-instance", "type");
+
+ private static final QName ENC_ARRAYTYPE = new QName("http://schemas.xmlsoap.org/soap/encoding/", "arrayType");
+
+ private static final QName ENC_OFFSET = new QName("http://schemas.xmlsoap.org/soap/encoding/", "offset");
+
+ private static final Set SKIPPED_SOAP_ATTRS = new HashSet(Arrays.asList(new QName[] { HREF, ID, ENC_OFFSET }));
+
+ private void processAttributes(SchemaType stype, XmlCursor xmlc) {
+ if (_soapEnc) {
+ QName typeName = stype.getName();
+ if (typeName != null) {
+ xmlc.insertAttributeWithValue(XSI_TYPE, formatQName(xmlc, typeName));
+ }
+ }
+
+ SchemaProperty[] attrProps = stype.getAttributeProperties();
+ for (int i = 0; i < attrProps.length; i++) {
+ SchemaProperty attr = attrProps[i];
+ if (_soapEnc) {
+ if (SKIPPED_SOAP_ATTRS.contains(attr.getName()))
+ continue;
+ if (ENC_ARRAYTYPE.equals(attr.getName())) {
+ SOAPArrayType arrayType = ((SchemaWSDLArrayType) stype.getAttributeModel().getAttribute(attr.getName())).getWSDLArrayType();
+ if (arrayType != null)
+ xmlc.insertAttributeWithValue(attr.getName(), formatQName(xmlc, arrayType.getQName()) + arrayType.soap11DimensionString());
+ continue;
+ }
+ }
+ String defaultValue = attr.getDefaultText();
+ xmlc.insertAttributeWithValue(attr.getName(), defaultValue == null ? sampleDataForSimpleType(attr.getType()) : defaultValue);
+ }
+ }
+
+ private void processSequence(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ SchemaParticle[] spc = sp.getParticleChildren();
+ for (int i = 0; i < spc.length; i++) {
+ /// <parent>maybestuff^</parent>
+ processParticle(spc[i], xmlc, mixed);
+ //<parent>maybestuff...morestuff^</parent>
+ if (mixed && i < spc.length - 1) {
+ if (isGenerate_sample_data()) {
+ xmlc.insertChars(pick(WORDS));
+ } else {
+ xmlc.insertChars("");
+ }
+ }
+ }
+ }
+
+ private void processChoice(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ SchemaParticle[] spc = sp.getParticleChildren();
+ xmlc.insertComment("You have a CHOICE of the next " + String.valueOf(spc.length) + " items at this level");
+ for (int i = 0; i < spc.length; i++) {
+ processParticle(spc[i], xmlc, mixed);
+ }
+ }
+
+ private void processAll(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ SchemaParticle[] spc = sp.getParticleChildren();
+ // xmlc.insertComment("You may enter the following " + String.valueOf(spc.length) + " items in any order");
+ for (int i = 0; i < spc.length; i++) {
+ processParticle(spc[i], xmlc, mixed);
+ if (mixed && i < spc.length - 1)
+ xmlc.insertChars(pick(WORDS));
+ }
+ }
+
+ private void processWildCard(SchemaParticle sp, XmlCursor xmlc, boolean mixed) {
+ xmlc.insertComment("You may enter ANY elements at this point");
+ xmlc.insertElement("AnyElement");
+ }
+
+ /**
+ * This method will get the base type for the schema type
+ */
+
+ private static QName getClosestName(SchemaType sType) {
+ while (sType.getName() == null)
+ sType = sType.getBaseType();
+
+ return sType.getName();
+ }
+
+ private String printParticleType(int particleType) {
+ StringBuffer returnParticleType = new StringBuffer();
+ returnParticleType.append("Schema Particle Type: ");
+
+ switch (particleType) {
+ case SchemaParticle.ALL:
+ returnParticleType.append("ALL\n");
+ break;
+ case SchemaParticle.CHOICE:
+ returnParticleType.append("CHOICE\n");
+ break;
+ case SchemaParticle.ELEMENT:
+ returnParticleType.append("ELEMENT\n");
+ break;
+ case SchemaParticle.SEQUENCE:
+ returnParticleType.append("SEQUENCE\n");
+ break;
+ case SchemaParticle.WILDCARD:
+ returnParticleType.append("WILDCARD\n");
+ break;
+ default:
+ returnParticleType.append("Schema Particle Type Unknown");
+ break;
+ }
+
+ return returnParticleType.toString();
+ }
+
+ private ArrayList _typeStack = new ArrayList();
+
+ public boolean isGenerate_sample_data() {
+ return generate_sample_data;
+ }
+
+ public void setGenerate_sample_data(boolean generate_sample_data) {
+ this.generate_sample_data = generate_sample_data;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XBbasedXMLGenerator.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XBbasedXMLGenerator.java
new file mode 100644
index 0000000000..128d65cecd
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XBbasedXMLGenerator.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator;
+import org.xml.sax.InputSource;
+
+import com.ibm.wsdl.util.xml.DOM2Writer;
+
+public class XBbasedXMLGenerator extends SchemaInstanceGenerator implements XMLGenerator {
+ private XMLfromXSDConfiguration config = null;
+
+ public static final String QNAME_SEPARATOR = "#";
+
+ public XBbasedXMLGenerator(XMLfromXSDConfiguration config) {
+ this.config = config;
+ // config.setXsdInputStream(getClass().getResource(conf).openStream());
+ }
+
+ public Hashtable<String, XmlObject> generateXmlAll() throws Exception {
+ Hashtable<String, XmlObject> xmlInstances = new Hashtable<String, XmlObject>();
+ TuscanySampleXmlUtil xmlUtil = new TuscanySampleXmlUtil();
+ xmlUtil.setGenerate_sample_data(config.isGenerateSampleData());
+ SchemaTypeSystem sts = processXSDSources();
+ SchemaType elementType = null;
+ for (SchemaGlobalElement globalElement : sts.globalElements()) {
+ elementType = getRootElementSchemaType(sts, globalElement.getName().getNamespaceURI(), globalElement.getName().getLocalPart());
+ xmlInstances.put(makeQName(globalElement.getName()), XmlObject.Factory.parse(xmlUtil.createSampleForType(elementType)));
+ }
+
+ return xmlInstances;
+ }
+
+ public String generateXMLAsString() throws Exception {
+ SchemaTypeSystem sts = processXSDSources();
+ SchemaType rootElementType = getRootElementSchemaType(sts, config.getSchemaTypeNamespaceURI(), config.getSchemaTypeName());
+ String result = "";
+ if (rootElementType != null) {
+ TuscanySampleXmlUtil xmlUtil = new TuscanySampleXmlUtil();
+ xmlUtil.setGenerate_sample_data(config.isGenerateSampleData());
+ result = xmlUtil.createSampleForType(rootElementType);
+ } else {
+ System.out.println("Could not find a global element with name \"" + config.getRootElementLocalName() + "\"");
+ }
+ return result;
+ }
+
+ public void generateXMLIntoOutputStream() throws Exception {
+ config.getXmlOutputStream().write(generateXMLAsString().getBytes());
+ }
+
+ public void generateXML() throws Exception {
+ SchemaTypeSystem sts = processXSDSources();
+
+ SchemaType rootElementType = getRootElementSchemaType(sts, config.getSchemaTypeNamespaceURI(), config.getSchemaTypeName());
+
+ if (rootElementType != null) {
+ TuscanySampleXmlUtil xmlUtil = new TuscanySampleXmlUtil();
+ xmlUtil.setGenerate_sample_data(config.isGenerateSampleData());
+ String result = xmlUtil.createSampleForType(rootElementType);
+ config.getXmlOutputStream().write(result.getBytes());
+ // System.out.println(result);
+ } else {
+ System.out.println("Could not find a global element with name \"" + config.getRootElementLocalName() + "\"");
+ }
+ }
+
+ protected SchemaType getRootElementSchemaType(SchemaTypeSystem sts, String schemaNamespace, String schemaTypeName) {
+ SchemaType schemaType = null;
+
+ if (sts == null) {
+ System.out.println("No Schemas to process.");
+ } else {
+ // first check in the global types
+ SchemaType[] globalTypes = sts.globalTypes();
+ for (int i = 0; i < globalTypes.length; i++) {
+ if (schemaNamespace.equals(globalTypes[i].getName().getNamespaceURI())
+ && schemaTypeName.equals(globalTypes[i].getName().getLocalPart())) {
+ schemaType = globalTypes[i];
+ break;
+ }
+ }
+
+ // next check for anonymous types defined inline within elements
+ if (schemaType == null) {
+ SchemaType[] globalElems = sts.documentTypes();
+ for (int i = 0; i < globalElems.length; i++) {
+ if (schemaNamespace.equals(globalElems[i].getDocumentElementName().getNamespaceURI())
+ && schemaTypeName.equals(globalElems[i].getDocumentElementName().getLocalPart())) {
+ schemaType = globalElems[i];
+ break;
+ }
+ }
+ }
+ }
+ return schemaType;
+ }
+
+ public void generateXML(XMLfromXSDConfiguration config) throws Exception {
+ this.config = config;
+ generateXML();
+ }
+
+ public XMLfromXSDConfiguration getConfig() {
+ return config;
+ }
+
+ public void setConfig(XMLfromXSDConfiguration config) {
+ this.config = config;
+ }
+
+ private Definition readInTheWSDLFile(InputStream wsdlStream) throws WSDLException {
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.importDocuments", true);
+
+ /*
+ * File file = new File(uri); String baseURI;
+ *
+ * if (uri.startsWith("http://")){ baseURI = uri; } else{ if(file.getParentFile() == null){ try { baseURI = new
+ * File(".").getCanonicalFile().toURI().toString(); } catch (IOException e) { throw new RuntimeException(e); } } else { baseURI =
+ * file.getParentFile().toURI().toString(); } }
+ */
+ // Document doc;
+ InputSource inputSource;
+ try {
+
+ // doc = XMLUtils.newDocument(wsdlStream);
+ inputSource = new InputSource(wsdlStream);
+ /*
+ * } catch (ParserConfigurationException e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Error", e); }
+ * catch (SAXException e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Parser SAX Error", e);
+ */
+ } catch (Exception e) {
+ throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e);
+ }
+
+ // return reader.readWSDL(config.getRootElementNamespaceURI(), doc);
+ return reader.readWSDL(config.getRootElementNamespaceURI(), inputSource);
+ }
+
+ protected InputStream[] getXSDsFromWSDL(InputStream xsdInputStream) throws Exception {
+ Definition defn = readInTheWSDLFile(xsdInputStream);
+ List list = defn.getTypes().getExtensibilityElements();
+
+ InputStream[] xsdFragments = new InputStream[list.size()];
+
+ Iterator iterator = list.iterator();
+ Schema schemaElement = null;
+
+ for (int count = 0; count < list.size(); ++count) {
+ schemaElement = (Schema) iterator.next();
+ // System.out.println(" *** - " + element.getElementType().getNamespaceURI());
+ // System.out.println(" **** - " + element + " & " + element.getClass().getPackage().getName());
+ // System.out.println(DOM2Writer.nodeToString(element.getElement()));
+ xsdFragments[count] = new ByteArrayInputStream(DOM2Writer.nodeToString(schemaElement.getElement()).getBytes());
+ }
+
+ return xsdFragments;
+ }
+
+ protected SchemaTypeSystem processXSDSources() throws Exception {
+ SchemaTypeSystem sts = null;
+ if (config.getXsdFileName().endsWith(XSD_FILE)) {
+ sts = processXSDs(new InputStream[] { config.getXsdInputStream() });
+ } else if (config.getXsdFileName().endsWith(WSDL_FILE)) {
+ sts = processXSDs(getXSDsFromWSDL(config.getXsdInputStream()));
+ }
+ return sts;
+ }
+
+ protected SchemaTypeSystem processXSDs(InputStream[] inputStreams) {
+ List sdocs = new ArrayList();
+ for (int i = 0; i < inputStreams.length; i++) {
+ try {
+ sdocs.add(XmlObject.Factory.parse(inputStreams[i], (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
+ } catch (Exception e) {
+ System.err.println("Can not load schema file: " + inputStreams[i] + ": ");
+ e.printStackTrace();
+ }
+ }
+
+ XmlObject[] schemas = (XmlObject[]) sdocs.toArray(new XmlObject[sdocs.size()]);
+
+ SchemaTypeSystem sts = null;
+ if (schemas.length > 0) {
+ Collection errors = new ArrayList();
+ XmlOptions compileOptions = new XmlOptions();
+ /*
+ * if (dl) compileOptions.setCompileDownloadUrls(); if (nopvr) compileOptions.setCompileNoPvrRule(); if (noupa)
+ * compileOptions.setCompileNoUpaRule();
+ */
+ try {
+ sts = XmlBeans.compileXsd(schemas, XmlBeans.getBuiltinTypeSystem(), compileOptions);
+ } catch (Exception e) {
+ if (errors.isEmpty() || !(e instanceof XmlException))
+ e.printStackTrace();
+
+ System.out.println("Schema compilation errors: ");
+ for (Iterator i = errors.iterator(); i.hasNext();)
+ System.out.println(i.next());
+ }
+ }
+
+ return sts;
+ }
+
+ private String makeQName(String nameSpace, String localName) {
+ return nameSpace + QNAME_SEPARATOR + localName;
+ }
+
+ private String makeQName(QName qName) {
+ return qName.getNamespaceURI() + QNAME_SEPARATOR + qName.getLocalPart();
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGenerator.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGenerator.java
new file mode 100644
index 0000000000..15848158e6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGenerator.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import java.util.Hashtable;
+
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * This is the XMLGenerator Interface that will be implemented by various
+ * types of Generators (SDO based, XMLBeans based etc.)
+ *
+ */
+public interface XMLGenerator {
+ public static final int SDO_BASED = 1;
+
+ public static final int XMLBEANS_BASED = 2;
+
+ public static final String XSD_FILE = ".xsd";
+
+ public static final String WSDL_FILE = ".wsdl";
+
+ public void generateXML() throws Exception;
+
+ public void generateXML(XMLfromXSDConfiguration config) throws Exception;
+
+ public void generateXMLIntoOutputStream() throws Exception;
+
+ public String generateXMLAsString() throws Exception;
+
+ public Hashtable<String, XmlObject> generateXmlAll() throws Exception;
+
+ public XMLfromXSDConfiguration getConfig();
+
+ public void setConfig(XMLfromXSDConfiguration config);
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGeneratorFactory.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGeneratorFactory.java
new file mode 100644
index 0000000000..e4075557e8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLGeneratorFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+/**
+ * This is a factory for creating XML Generators. The types of XML Generators
+ * are enumerated in the XMLGenerator interface.
+ *
+ */
+public class XMLGeneratorFactory {
+ private static XMLGeneratorFactory factory = null;
+
+ protected XMLGeneratorFactory() {
+
+ }
+
+ public static XMLGeneratorFactory getInstance() {
+ if (factory == null) {
+ factory = new XMLGeneratorFactory();
+ }
+ return factory;
+ }
+
+ public XMLGenerator createGenerator(int generatorType) {
+ XMLGenerator generator = null;
+ switch (generatorType) {
+ case XMLGenerator.SDO_BASED: {
+ // generator = new SDObasedXMLGenerator(new XMLfromXSDConfiguration());
+ break;
+ }
+ case XMLGenerator.XMLBEANS_BASED: {
+ generator = new XBbasedXMLGenerator(new XMLfromXSDConfiguration());
+ break;
+ }
+ }
+
+ return generator;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDConfiguration.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDConfiguration.java
new file mode 100644
index 0000000000..76f6b711bd
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDConfiguration.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+/**
+ * This class encapsulates the configuration settings for the "XML From XSD" generation.
+ * Presently it contains settings like the XSD to be use, the schematype for which and
+ * xml instance is to be created, the destination for the output etc. All of these
+ * settings are used by the 'generator' classes during the genation of the xml instance.
+ *
+ */
+public class XMLfromXSDConfiguration implements CmdLineArgsHandler {
+ private static int fileCount = 0;
+
+ public static final String DEFAULT_XML_OUTPUT_FILENAME = "XML_FROM_XSD_" + (++fileCount) + ".xml";
+
+ public static final String XSD_FILE_URL_OPTION = "xsd";
+
+ public static final String XML_OUTPUT_LOCATION_OPTION = "o";
+
+ public static final String XML_OUTPUT_FILENAME_OPTION = "of";
+
+ public static final String ROOT_ELEMENT_NAMESPACE_URI_OPTION = "rns";
+
+ public static final String ROOT_ELEMENT_LOCALNAME_OPTION = "rn";
+
+ public static final String SCHEMA_TYPE_NAME = "st";
+
+ public static final String SCHEMA_TYPE_NAMESPACE_URI = "stn";
+
+ public static final String GENERATE_SAMPLE_DATA = "sd";
+
+ protected String xmlOutputLocation = null;
+
+ protected File xmlOutputDirectory = null;
+
+ protected String xsdFileName = null;
+
+ protected String xmlFileName = null;
+
+ protected InputStream xsdInputStream = null;
+
+ protected OutputStream xmlOutputStream = null;
+
+ protected String rootElementNamespaceURI = null;
+
+ protected String rootElementLocalName = null;
+
+ protected String schemaTypeName = null;
+
+ protected String schemaTypeNamespaceURI = null;
+
+ protected boolean generateSampleData = false;
+
+ private void handleXSDInputFileOption(String xsdFileUrl) throws Exception {
+ xsdFileName = xsdFileUrl;
+ // xsdInputStream = new FileInputStream(new File(xsdFileName));
+ URL resourceUrl = Thread.currentThread().getContextClassLoader().getResource(xsdFileName);
+ if (resourceUrl != null) {
+ xsdInputStream = resourceUrl.openStream();
+ } else {
+ File inFile = new File(xsdFileName);
+ xsdFileName = inFile.getName();
+ xsdInputStream = new FileInputStream(inFile);
+ }
+ }
+
+ private void handleXMLOutputLocationOption(String outputLocation) throws Exception {
+ xmlOutputLocation = outputLocation;
+ xmlOutputDirectory = new File(xmlOutputLocation);
+ if (!xmlOutputDirectory.exists()) {
+ xmlOutputDirectory.mkdirs();
+ } else if (!xmlOutputDirectory.isDirectory()) {
+ throw new IllegalArgumentException("The input location for the xml output " + outputLocation + "is not a folder");
+ }
+ }
+
+ private void handleOutputFilenameOption(String outputFileName) throws Exception {
+ xmlFileName = outputFileName;
+
+ // first create a file in the given location
+ File outputFile = new File(xmlOutputDirectory, xmlFileName);
+
+ try {
+ if (!outputFile.exists()) {
+ outputFile.createNewFile();
+ }
+ xmlOutputStream = new FileOutputStream(outputFile);
+ } catch (IOException e) {
+ throw new Exception(e);
+ }
+ }
+
+ public void handleArgument(String optionFlag, String argValue) throws IllegalArgumentException {
+ try {
+ if (XSD_FILE_URL_OPTION.equalsIgnoreCase(optionFlag)) {
+ handleXSDInputFileOption(argValue);
+ } else if (XML_OUTPUT_LOCATION_OPTION.equalsIgnoreCase(optionFlag)) {
+ handleXMLOutputLocationOption(argValue);
+ } else if (XML_OUTPUT_FILENAME_OPTION.equalsIgnoreCase(optionFlag)) {
+ handleOutputFilenameOption(argValue);
+ } else if (ROOT_ELEMENT_NAMESPACE_URI_OPTION.equalsIgnoreCase(optionFlag)) {
+ setRootElementNamespaceURI(argValue);
+ } else if (ROOT_ELEMENT_LOCALNAME_OPTION.equalsIgnoreCase(optionFlag)) {
+ setRootElementLocalName(argValue);
+ } else if (SCHEMA_TYPE_NAME.equalsIgnoreCase(optionFlag)) {
+ setSchemaTypeName(argValue);
+ } else if (SCHEMA_TYPE_NAMESPACE_URI.equalsIgnoreCase(optionFlag)) {
+ setSchemaTypeNamespaceURI(argValue);
+ } else if (GENERATE_SAMPLE_DATA.equalsIgnoreCase(optionFlag)) {
+ setGenerateSampleData(true);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Exception due to - " + e);
+ }
+ }
+
+ public String getRootElementLocalName() {
+ if (rootElementLocalName == null) {
+ rootElementLocalName = schemaTypeName.toLowerCase();
+ }
+ return rootElementLocalName;
+ }
+
+ public void setRootElementLocalName(String rootElementLocalName) {
+ this.rootElementLocalName = rootElementLocalName;
+ }
+
+ public String getRootElementNamespaceURI() {
+ if (rootElementNamespaceURI == null) {
+ rootElementNamespaceURI = schemaTypeNamespaceURI;
+ }
+ return rootElementNamespaceURI;
+ }
+
+ public void setRootElementNamespaceURI(String rootElementNamespaceURI) {
+ this.rootElementNamespaceURI = rootElementNamespaceURI;
+ }
+
+ public String getXmlFileName() {
+ if (xmlFileName == null) {
+ xmlFileName = getXsdFileName() + ".xml";
+ }
+ return xmlFileName;
+ }
+
+ public void setXmlFileName(String xmlFileName) {
+ this.xmlFileName = xmlFileName;
+ }
+
+ public File getXmlOutputLocation() {
+ return xmlOutputDirectory;
+ }
+
+ public void setXmlOutputLocation(File xmlOutputLocation) {
+ this.xmlOutputDirectory = xmlOutputLocation;
+ }
+
+ public OutputStream getXmlOutputStream() throws Exception {
+ if (xmlOutputStream == null) {
+ if (xmlOutputDirectory == null) {
+ handleXMLOutputLocationOption(System.getProperty("user.dir"));
+ }
+ handleOutputFilenameOption(getXmlFileName());
+ }
+ return xmlOutputStream;
+ }
+
+ public void setXmlOutputStream(OutputStream xmlOutputStream) {
+ this.xmlOutputStream = xmlOutputStream;
+ }
+
+ public String getXsdFileName() {
+ return xsdFileName;
+ }
+
+ public void setXsdFileName(String xsdFileName) throws Exception {
+ this.xsdFileName = xsdFileName;
+ handleXSDInputFileOption(xsdFileName);
+ }
+
+ public InputStream getXsdInputStream() throws Exception {
+ if (xsdInputStream == null) {
+ throw new IllegalArgumentException("XSD Input Source not set....!");
+ }
+ return xsdInputStream;
+ }
+
+ public void setXsdInputStream(InputStream xsdInputStream) {
+ this.xsdInputStream = xsdInputStream;
+ }
+
+ public String getSchemaTypeName() {
+ return schemaTypeName;
+ }
+
+ public void setSchemaTypeName(String schemaTypeName) {
+ this.schemaTypeName = schemaTypeName;
+ }
+
+ public String getSchemaTypeNamespaceURI() {
+ return schemaTypeNamespaceURI;
+ }
+
+ public void setSchemaTypeNamespaceURI(String schemaTypeNamespaceURI) {
+ this.schemaTypeNamespaceURI = schemaTypeNamespaceURI;
+ }
+
+ public void setXmlOutputLocation(String xmlOutputLocation) throws Exception {
+ this.xmlOutputLocation = xmlOutputLocation;
+ handleXMLOutputLocationOption(xmlOutputLocation);
+ }
+
+ public boolean isGenerateSampleData() {
+ return generateSampleData;
+ }
+
+ public void setGenerateSampleData(boolean generateSampleData) {
+ this.generateSampleData = generateSampleData;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGenerator.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGenerator.java
new file mode 100644
index 0000000000..357d4203fe
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGenerator.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+/**
+ * This class provides a command line tooling functinality for creating an XML
+ * instance from an input XSD.
+ */
+public class XMLfromXSDGenerator {
+ public static int generatorType = XMLGenerator.XMLBEANS_BASED;
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ try {
+ new XMLfromXSDGenerator().generateXMLInstance(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(getPrintUsageMessage());
+ }
+ }
+
+ public void generateXMLInstance(String args[]) throws Exception {
+ // create a configuration object to hold settings for this generation
+ XMLfromXSDConfiguration config = new XMLfromXSDConfiguration();
+
+ // create an argument processor to process the input arguments
+ CmdLineArgsProcessor argsProcessor = new CmdLineArgsProcessor();
+
+ // configure the args processor with the 'config' object that must be populated
+ // with values from the proecessed input arguments
+ argsProcessor.setArgsHandler(config);
+
+ // set the usage message to be output by the args processor if input arguments are not proper
+ argsProcessor.setPrintUsageMessage(getPrintUsageMessage());
+
+ // start processing the arguments
+ argsProcessor.processArgs(args);
+
+ // now that the configuration settings are populated from the input arguments
+ // instantiate the xmlfromsdogenerator with this config object
+
+ XMLGenerator generator = new XMLGeneratorFactory().createGenerator(generatorType);
+ // XBbasedXMLGenerator generator = new XBbasedXMLGenerator(config);
+
+ // generate the xml instance
+ generator.generateXML(config);
+ }
+
+ protected static String getPrintUsageMessage() {
+ StringBuffer strBuffer = new StringBuffer();
+ strBuffer.append("Usage arguments:\n");
+ strBuffer.append(" [ -rns <root element namespace URI> ]\n");
+ strBuffer.append(" [ -rn <root element name> ]\n");
+ strBuffer.append(" [ -xsd <xsd file> ]\n");
+ strBuffer.append(" [ -of <output xml filename> ]\n");
+ strBuffer.append(" [ -o <output location> ]\n");
+ strBuffer.append(" [ -st <name of the schema type to be instantiated as xml> ]\n");
+ strBuffer.append(" [ -stn <namespace URI of the schema type> ]\n");
+ strBuffer.append(" [ -sd (provide this flag if sample data is to be generated)\n");
+
+ return strBuffer.toString();
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceCreationException.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceCreationException.java
new file mode 100644
index 0000000000..140d3efdb4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceCreationException.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+/**
+ * The Exception wrapper class for encasulating exceptions that occur during xml instance creation
+ *
+ */
+public class XmlInstanceCreationException extends Exception {
+
+ public XmlInstanceCreationException(String message) {
+ super(message);
+ }
+
+ public XmlInstanceCreationException(Exception e) {
+ super(e);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistry.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistry.java
new file mode 100644
index 0000000000..15f0fcfb73
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistry.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import java.util.Map;
+
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Interface for system registry of xml instances
+ *
+ */
+public interface XmlInstanceRegistry {
+ public Map<String, XmlObject> getXmlInstance(String wsdlPath) throws XmlInstanceCreationException;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistryImpl.java b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistryImpl.java
new file mode 100644
index 0000000000..0dacf44a77
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XmlInstanceRegistryImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * An implementation for the XMLInstnaceRegistry
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class XmlInstanceRegistryImpl implements XmlInstanceRegistry {
+
+ private Hashtable<String, Map<String, XmlObject>> wsdlXmlInstances;
+
+ private XMLGenerator xmlGenerator;
+
+ public XmlInstanceRegistryImpl() {
+ wsdlXmlInstances = new Hashtable<String, Map<String, XmlObject>>();
+
+ XMLfromXSDConfiguration generationConfig = new XMLfromXSDConfiguration();
+ xmlGenerator = XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED);
+ xmlGenerator.setConfig(generationConfig);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.tuscany.container.javascript.XmlInstanceRegistry#getXmlInstance(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Map<String, XmlObject> getXmlInstance(String wsdlPath) throws XmlInstanceCreationException {
+ Map<String, XmlObject> xmlInstanceMap = null;
+ if ((xmlInstanceMap = wsdlXmlInstances.get(wsdlPath)) == null) {
+ try {
+ xmlGenerator.getConfig().setXsdFileName(wsdlPath);
+ xmlInstanceMap = xmlGenerator.generateXmlAll();
+ wsdlXmlInstances.put(wsdlPath, xmlInstanceMap);
+ } catch (Exception e) {
+ throw new XmlInstanceCreationException(e);
+ }
+ }
+ return xmlInstanceMap;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..ec7ae5f47d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.launcher.JavaScriptImplementation">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.javascript</group>
+ <name>tuscany-javascript</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="javascript.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptImplementationLoader"/>
+ </component>
+
+ <component name="javascript.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="javascript.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentBuilder"/>
+ </component>
+
+ <!-- Xml Instance Registry service -->
+ <component name="xmlInstRegistry">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.utils.xmlfromxsd.XmlInstanceRegistryImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/js.system.scdl b/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/js.system.scdl
new file mode 100644
index 0000000000..0b473c7406
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/main/resources/META-INF/sca/js.system.scdl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.launcher.JavaScriptImplementation">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.javascript</group>
+ <name>tuscany-javascript</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="javascript.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptImplementationLoader"/>
+ </component>
+
+ <component name="javascript.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="javascript.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentBuilder"/>
+ </component>
+
+ <!-- Xml Instance Registry service -->
+ <component name="xmlInstRegistry">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.utils.xmlfromxsd.XmlInstanceRegistryImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..e0b1ab2303
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.axiom.om.OMElement;
+
+public interface HelloWorldService {
+
+ String sayHello(String s);
+ OMElement sayE4XHello(OMElement xmlObject);
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldServiceImpl.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..ac17e29eb0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/helloworld/HelloWorldServiceImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public OMElement sayE4XHello(OMElement xmlObject) {
+
+ String helloString = "<hel:getGreetingsResponse xmlns:hel=\"http://helloworld\">"
+ + "<hel:getGreetingsReturn>Hello from Java Implementation to </hel:getGreetingsReturn>NoString</hel:getGreetingsResponse>";
+
+ try {
+ String inputValue = xmlObject.getFirstElement().getText();
+
+ XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(helloString.getBytes()));
+
+ StAXOMBuilder staxOMBuilder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlReader);
+ OMElement response = staxOMBuilder.getDocumentElement();
+ response.getFirstElement().setText(response.getFirstElement().getText() + inputValue);
+
+ return response;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public String sayHello(String s) {
+ return "Hello " + s;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoaderTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..de62afc327
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoaderTestCase.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+
+/**
+ * Tests for JavaScriptImplementationLoader
+ */
+public class JavaScriptImplementationLoaderTestCase extends TestCase {
+ private CompositeComponent parent;
+
+ private XMLStreamReader reader;
+
+ private DeploymentContext deploymentContext;
+
+ private ClassLoader classLoader;
+
+ private LoaderRegistry registry;
+
+ private JavaScriptImplementationLoader loader;
+
+ public void testNoScriptAttribute() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn(null);
+ replay(reader);
+ replay(deploymentContext);
+
+ try {
+ loader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testNoScriptPresent() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn("foo.groovy");
+ expect(deploymentContext.getClassLoader()).andReturn(classLoader);
+
+ replay(reader);
+ replay(deploymentContext);
+
+ JavaScriptImplementationLoader mockLoader = new JavaScriptImplementationLoader(registry) {
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ assertSame(classLoader, cl);
+ assertEquals("foo.groovy", resource);
+ throw new MissingResourceException(resource);
+ }
+ };
+ try {
+ mockLoader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ assertEquals("foo.groovy", e.getIdentifier());
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testLoadScript() throws LoaderException {
+ String script =
+ loader.loadSource(getClass().getClassLoader(), "org/apache/tuscany/container/javascript/mock/test.js");
+ assertEquals("//Test Script", script);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ loader = new JavaScriptImplementationLoader(registry);
+
+ parent = createMock(CompositeComponent.class);
+ reader = createMock(XMLStreamReader.class);
+ deploymentContext = createMock(DeploymentContext.class);
+ classLoader = createMock(ClassLoader.class);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/PropertyTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/PropertyTestCase.java
new file mode 100644
index 0000000000..9318d9c125
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/PropertyTestCase.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+
+/**
+ * Tests for component properties
+ */
+public class PropertyTestCase extends TestCase {
+
+ private static final String SCRIPT = "function greet(name){ return property; }";
+
+ private RhinoScript implClass;
+
+ /**
+ * Tests injecting a simple property type on a Javascript implementation instance
+ */
+ public void testPropertyInjection() throws Exception {
+ /*CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ List<Class<?>> serviceBindings = new ArrayList<Class<?>>();
+ serviceBindings.add(Greeting.class);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("property", "bar");
+ WireService wireService = ArtifactFactory.createWireService();
+ JavaScriptComponent<Greeting> context = new JavaScriptComponent<Greeting>("source", implClass, serviceBindings, properties, null, scope, wireService, null);
+ scope.register(context);
+ Greeting greeting = context.getServiceInstance();
+ assertEquals("bar", greeting.greet("foo"));
+ scope.stop();*/
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ implClass = new RhinoScript("test", SCRIPT);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/RhinoScriptIntrospectorTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/RhinoScriptIntrospectorTestCase.java
new file mode 100644
index 0000000000..3b1b3de5e5
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/RhinoScriptIntrospectorTestCase.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import helloworld.HelloWorldService;
+import junit.framework.TestCase;
+import org.apache.tuscany.container.javascript.rhino.RhinoSCAConfig;
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl;
+
+public class RhinoScriptIntrospectorTestCase extends TestCase {
+
+ private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() {
+ public void readingWSDL(String namespace, URL location) {
+ }
+
+ public void cachingDefinition(String namespace, URL location) {
+ }
+ };
+
+ public void testJavaInterface() throws MissingResourceException, InvalidServiceContractException {
+ RhinoScript rs =
+ new RhinoScript("javaInterfaceTest", "SCA = { javaInterface : 'helloworld.HelloWorldService',};",
+ null, getClass().getClassLoader());
+ RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());
+ JavaScriptIntrospector introspector =
+ new JavaScriptIntrospector(null, new JavaInterfaceProcessorRegistryImpl());
+ ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
+ assertNotNull(comonentType);
+ Map services = comonentType.getServices();
+ assertEquals(1, services.size());
+ ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ assertTrue(serviceContract instanceof JavaServiceContract);
+ JavaServiceContract javaServiceContract = (JavaServiceContract) serviceContract;
+ assertEquals(HelloWorldService.class, javaServiceContract.getInterfaceClass());
+ }
+
+ public void testWSDLLocation() throws WSDLException {
+// RhinoScript rs = new RhinoScript("wsdlLocation",
+// "SCA = { wsdlLocation : 'src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl',};", null, getClass()
+// .getClassLoader());
+// RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());
+// JavaScriptIntrospector introspector = new JavaScriptIntrospector(null);
+// ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
+// assertNotNull(comonentType);
+// Map serviceBindings = comonentType.getServices();
+// assertEquals(1, serviceBindings.size());
+// ServiceDefinition serviceDefinition = (ServiceDefinition) serviceBindings.values().iterator().next();
+// ServiceContract serviceContract = serviceDefinition.getServiceContract();
+// assertTrue(serviceContract instanceof WSDLServiceContract);
+// WSDLServiceContract wsdlServiceContract = (WSDLServiceContract) serviceContract;
+// assertEquals(new QName("http://helloworld", "HelloWorld"), wsdlServiceContract.getPortType().getQName());
+ }
+
+ public void testWSDLPortType() throws WSDLException, IOException, MissingResourceException,
+ InvalidServiceContractException {
+ RhinoScript rs = new RhinoScript("wsdlPortType",
+ "SCA = { wsdlPortType : 'HelloWorld', wsdlNamespace : 'http://helloworld',};", null,
+ getClass().getClassLoader());
+ RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());
+
+ WSDLDefinitionRegistryImpl wsdlReg = new WSDLDefinitionRegistryImpl();
+ wsdlReg.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ wsdlReg.setMonitor(NULL_MONITOR);
+ URL wsdlURL =
+ getClass().getClassLoader().getResource("org/apache/tuscany/container/javascript/rhino/helloworld.wsdl");
+ wsdlReg.loadDefinition("http://helloworld", wsdlURL);
+
+ JavaScriptIntrospector introspector =
+ new JavaScriptIntrospector(wsdlReg, new JavaInterfaceProcessorRegistryImpl());
+ ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
+ assertNotNull(comonentType);
+ Map services = comonentType.getServices();
+ assertEquals(1, services.size());
+ ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ assertTrue(serviceContract instanceof WSDLServiceContract);
+ WSDLServiceContract wsdlServiceContract = (WSDLServiceContract) serviceContract;
+ assertEquals(new QName("http://helloworld", "HelloWorld"), wsdlServiceContract.getPortType().getQName());
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/ScriptInvokeTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/ScriptInvokeTestCase.java
new file mode 100644
index 0000000000..e852625bd9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/ScriptInvokeTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+
+/**
+ * Tests for invoker JavaScriptComponents
+ */
+public class ScriptInvokeTestCase extends TestCase {
+
+ private static final String SCRIPT = "function greet(name) { return name }";
+
+ private RhinoScript rhinoScript;
+
+ /**
+ * Tests the invocation of a Groovy "script" as opposed to a class
+ */
+ public void testBasicScriptInvocation() throws Exception {
+// CompositeScopeContainer scope = new CompositeScopeContainer(null);
+// scope.start();
+// List<Class<?>> serviceBindings = new ArrayList<Class<?>>();
+// serviceBindings.add(Greeting.class);
+// JavaScriptComponent<Greeting> context = new JavaScriptComponent<Greeting>("source", rhinoScript, serviceBindings, new HashMap<String, Object>(),
+// null, scope, ArtifactFactory.createWireService(), null);
+// scope.register(context);
+// Greeting object = (Greeting) context.getServiceInstance();
+// assertEquals("foo", object.greet("foo"));
+// scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ rhinoScript = new RhinoScript("test", SCRIPT);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/WireTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/WireTestCase.java
new file mode 100644
index 0000000000..58a831f66a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/WireTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.javascript.mock.Greeting;
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.test.ArtifactFactory;
+import static org.easymock.EasyMock.reportMatcher;
+import org.easymock.IArgumentMatcher;
+
+/**
+ * Tests for JavaScript component wiring
+ */
+public class WireTestCase extends TestCase {
+
+ private static final String SCRIPT =
+ " function setWire(ref){" +
+ " wire = ref;" + " }" +
+ " " +
+ " function greet(name){" +
+ " return wire.greet(name); " +
+ " }";
+
+ private static final String SCRIPT2 =
+ " function greet(name){" +
+ " return name; " +
+ " }";
+
+ private RhinoScript implClass1;
+
+ private RhinoScript implClass2;
+ private WireService wireService;
+
+ /**
+ * Tests a basic invocation down a source wire
+ */
+ public void testReferenceWireInvocation() throws Exception {
+// CompositeScopeContainer scope = new CompositeScopeContainer(null);
+// scope.start();
+//
+// List<Class<?>> serviceBindings = new ArrayList<Class<?>>();
+// serviceBindings.add(Greeting.class);
+// JavaScriptComponent<Greeting> context = new JavaScriptComponent<Greeting>("source", implClass1, serviceBindings, properties, null, scope,
+// ArtifactFactory.createWireService(), null);
+// OutboundWire wire = ArtifactFactory.createOutboundWire("wire", Greeting.class);
+// ArtifactFactory.terminateWire(wire);
+//
+// TargetInvoker invoker = createMock(TargetInvoker.class);
+// expect(invoker.isCacheable()).andReturn(false);
+// Message response = new MessageImpl();
+// response.setBody("foo");
+// expect(invoker.invoke(eqMessage())).andReturn(response);
+// replay(invoker);
+//
+// for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
+// chain.setTargetInvoker(invoker);
+// }
+// scope.register(context);
+// context.addOutboundWire(wire);
+// Greeting greeting = context.getServiceInstance();
+// assertEquals("foo", greeting.greet("foo"));
+// verify(invoker);
+//
+// scope.stop();
+ }
+
+ // todo this could be generalized and moved to test module
+ public static Message eqMessage() {
+ reportMatcher(new IArgumentMatcher() {
+ public boolean matches(Object object) {
+ if (!(object instanceof Message)) {
+ return false;
+ }
+ final Message msg = (Message) object;
+ Object[] body = (Object[]) msg.getBody();
+ return "foo".equals(body[0]);
+ }
+
+ public void appendTo(StringBuffer stringBuffer) {
+ }
+ });
+ return null;
+ }
+
+ /**
+ * Tests a basic invocation to a target
+ */
+ public void testTargetInvocation() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ JavaScriptComponent context =
+ new JavaScriptComponent("source", implClass2, new HashMap<String, Object>(), null,
+ ArtifactFactory.createWireService(), null, null);
+ context.setScopeContainer(scope);
+ scope.register(context);
+ Operation<Type> operation = new Operation<Type>("greet", null, null, null, false, null, NO_CONVERSATION);
+ TargetInvoker invoker = context.createTargetInvoker(null, operation, null);
+ assertEquals("foo", invoker.invokeTarget(new String[]{"foo"}, TargetInvoker.NONE));
+ scope.stop();
+ }
+
+ /**
+ * Tests a basic invocation down a target wire
+ */
+ public void testTargetWireInvocation() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ JavaScriptComponent context =
+ new JavaScriptComponent("source", implClass2, new HashMap<String, Object>(), null,
+ ArtifactFactory.createWireService(), null, null);
+ context.setScopeContainer(scope);
+ scope.register(context);
+
+ InboundWire wire = ArtifactFactory.createLocalInboundWire("Greeting", Greeting.class);
+ ArtifactFactory.terminateWire(wire);
+ for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(context.createTargetInvoker(null, chain.getOperation(), null));
+ }
+ context.addInboundWire(wire);
+ Greeting greeting = wireService.createProxy(Greeting.class, context.getInboundWire("Greeting"));
+ assertEquals("foo", greeting.greet("foo"));
+ scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireService = ArtifactFactory.createWireService();
+ implClass1 = new RhinoScript("script1", SCRIPT);
+ implClass2 = new RhinoScript("script2", SCRIPT2);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/HelloWorldTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/HelloWorldTestCase.java
new file mode 100644
index 0000000000..3db49618e2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/HelloWorldTestCase.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.function;
+
+import helloworld.HelloWorldService;
+
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class HelloWorldTestCase extends SCATestCase {
+
+ private CompositeContext context;
+
+ protected void setUp() throws Exception {
+ URL base = getClass().getResource("/META-INF/sca/js.system.scdl");
+ addExtension("JavaScriptContainer", new URL(base, "default.scdl"));
+ setApplicationSCDL(getClass().getResource("helloworld.scdl"));
+ super.setUp();
+
+ context = CurrentCompositeContext.getContext();
+ }
+
+ public void testHelloWorld() throws Exception {
+ HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
+ assertEquals(helloWorldService.sayHello("petra"), "Hello petra");
+ }
+
+ public void testIntrospectedHelloWorld() throws Exception {
+ HelloWorldService introspectableService = context.locateService(HelloWorldService.class, "IntrospectableHelloWorldComponent");
+ assertEquals(introspectableService.sayHello("petra"), "Hello petra");
+ }
+
+ public void testE4XImplInvocation() throws Exception {
+ HelloWorldService e4xHelloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponentE4X");
+ String xmlInput = "<hel:getGreetings xmlns:hel=\"http://helloworld\"> " +
+ "<hel:name>TuscanyWorld</hel:name> " +
+ "</hel:getGreetings>";
+
+ XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(
+ new ByteArrayInputStream(xmlInput.getBytes()));
+ StAXOMBuilder staxOMBuilder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlReader);
+ Object response = e4xHelloWorldService.sayE4XHello(staxOMBuilder.getDocumentElement());
+ assertNotNull(response);
+ assertTrue(response instanceof OMElement);
+ assertEquals("e4xHello TuscanyWorld", ((OMElement)response).getFirstElement().getText());
+ //System.out.println(response);
+ }
+
+ public void testE4XRefInvocation() throws Exception
+ {
+ HelloWorldService e4xHelloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponentE4X");
+
+ String initialInput = "JavaClient";
+ String jsAddition = " thro e4x reference";
+ String endSvcImplResponse = "Hello from Java Implementation to ";
+
+ Object response = e4xHelloWorldService.sayHello(initialInput);
+ assertNotNull(response);
+ assertTrue(response instanceof String);
+ assertEquals(endSvcImplResponse + initialInput + jsAddition, response.toString());
+ //System.out.println(response);
+ }
+
+ public void testHelloWorldProperty() throws Exception {
+ HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldProperty");
+ assertEquals(helloWorldService.sayHello("petra"), "Kia ora petra");
+ System.out.println(helloWorldService.sayHello("petra"));
+ }
+
+ public void testHelloWorldPropertyDefault() throws Exception {
+ HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldPropertyDefault");
+ assertEquals(helloWorldService.sayHello("petra"), "Hi petra");
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/ScopeTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/ScopeTestCase.java
new file mode 100644
index 0000000000..b823939e6c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/function/ScopeTestCase.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.function;
+
+import java.net.URL;
+
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class ScopeTestCase extends SCATestCase {
+
+ private CompositeContext context;
+
+ protected void setUp() throws Exception {
+ URL base = getClass().getResource("/META-INF/sca/js.system.scdl");
+ addExtension("JavaScriptContainer", new URL(base, "default.scdl"));
+ setApplicationSCDL(getClass().getResource("scopeTest.scdl"));
+ super.setUp();
+
+ context = CurrentCompositeContext.getContext();
+ }
+
+// Composite scope not implemented in core yet
+// public void testComposite() throws Exception {
+// HelloWorldService composoteScopeService = context.locateService(HelloWorldService.class, "ComposoteScopeService");
+// assertEquals("1", composoteScopeService.sayHello(""));
+// assertEquals("2", composoteScopeService.sayHello(""));
+// }
+
+ public void testStateless() throws Exception {
+ HelloWorldService statelessService = context.locateService(HelloWorldService.class, "StatelessComponent");
+ assertEquals("1", statelessService.sayHello(""));
+ // stateless gives a new instance for each request
+ assertEquals("1", statelessService.sayHello(""));
+ }
+
+// Request scope not implemented in core yet
+// public void testRequestState() throws Exception {
+// HelloWorldService requestService = context.locateService(HelloWorldService.class, "RequestComponent");
+// assertEquals("1", requestService.sayHello(""));
+// assertEquals("1", requestService.sayHello(""));
+// }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/mock/Greeting.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/mock/Greeting.java
new file mode 100644
index 0000000000..e300f73469
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/mock/Greeting.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.mock;
+
+public interface Greeting {
+
+ String setWire(Greeting ref);
+
+ String greet(String name);
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/Foo.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/Foo.java
new file mode 100644
index 0000000000..397501a23b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/Foo.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+class Foo {
+ private String s;
+
+ public Foo() {
+ }
+
+ public String getS() {
+ return s;
+ }
+
+ public void setS(String s) {
+ this.s = s;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvokerTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvokerTestCase.java
new file mode 100644
index 0000000000..dad61659f3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvokerTestCase.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Tests for the RhinoFunctionInvoker
+ */
+public class RhinoFunctionInvokerTestCase extends TestCase {
+
+ public RhinoFunctionInvokerTestCase() {
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testNoArgsInvoke() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getPetra() {return 'petra';}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getPetra");
+ assertNotNull(invoker);
+ assertEquals("petra", invoker.invoke(null));
+ }
+
+ public void testOneArgInvoke() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getS(s) {return s;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getS");
+ assertNotNull(invoker);
+ assertEquals("petra", invoker.invoke(new Object[] { "petra" }));
+ }
+
+ public void testMultiArgsInvoke() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function concat(x, y) {return x + y}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("concat");
+ assertNotNull(invoker);
+ assertEquals("petrasue", invoker.invoke(new Object[] { "petra", "sue" }));
+ }
+
+ public void testNoResponseInvoke() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getNull() {}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getNull");
+ assertNotNull(invoker);
+ assertEquals(null, invoker.invoke(new Object[0]));
+ }
+
+ public void testNullResponseInvoke() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getNull() {return null;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getNull");
+ assertNotNull(invoker);
+ assertEquals(null, invoker.invoke(new Object[0]));
+ }
+
+ public void testResponseTypeDefaultString() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getTrue() {return true;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getTrue");
+ assertNotNull(invoker);
+ Object o = invoker.invoke(new Object[0]);
+ assertTrue(o instanceof String);
+ assertEquals("true", o);
+ }
+
+ public void testResponseTypeBoolean() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getTrue() {return true;}");
+ //rhinoScript.setResponseClass("getTrue", Boolean.class);
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getTrue", Boolean.class);
+ assertNotNull(invoker);
+ assertTrue((Boolean) invoker.invoke(new Object[0]));
+ }
+
+ public void testResponseTypeStringArray() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getAs() {var as = new Array(1);as[0]='petra';return as;}");
+ //rhinoScript.setResponseClass("getAs", new String[0].getClass());
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getAs", new String[0].getClass());
+ assertNotNull(invoker);
+ Object o = invoker.invoke(new Object[0]);
+ assertNotNull(o);
+ assertTrue(o.getClass().isArray());
+ assertEquals("petra", ((Object[]) o)[0]);
+ }
+
+ public void testResponseTypeBooleanArray() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getBs() {var bs = new Array(1);bs[0]=true;return bs;}");
+ rhinoScript.setResponseClass("getBs", new Boolean[0].getClass());
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getBs", new Boolean[0].getClass());
+ assertNotNull(invoker);
+ Object o = invoker.invoke(new Object[0]);
+ assertNotNull(o);
+ assertTrue(o.getClass().isArray());
+ assertTrue(((Boolean[]) o)[0]);
+ }
+
+ public void testRequestCustomType() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getFooS(foo) {return foo.getS();}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getFooS");
+ assertNotNull(invoker);
+
+ Foo foo = new Foo();
+ foo.setS("petra");
+ Object o = invoker.invoke(new Object[] { foo });
+ assertEquals(foo.getS(), o);
+ }
+
+ public void testResponseCustomType() {
+ RhinoScript rhinoScript = new RhinoScript("foo",
+ "importClass(Packages.org.apache.tuscany.container.javascript.rhino.Foo);function getFoo(s) {var foo = new Foo(); foo.setS(s);return foo;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getFoo");
+ assertNotNull(invoker);
+
+ Object o = invoker.invoke(new Object[] { "petra" });
+ assertNotNull(o);
+ assertEquals("petra", ((Foo) o).getS());
+ }
+
+ public void testXMLRequest() throws XmlException, IOException {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function isXML(x) {return 'xml' == (typeof x);}");
+ //rhinoScript.setResponseClass("isXML", Boolean.class);
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("isXML", Boolean.class);
+ assertNotNull(invoker);
+
+ Object xml = XmlObject.Factory.parse("<a><b/></a>");
+ assertTrue((Boolean) invoker.invoke(new Object[] { xml }));
+
+ Object notXML = "notXML";
+ assertFalse((Boolean) invoker.invoke(new Object[] { notXML }));
+ }
+
+ public void testXMLResponse() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getXML(s) {return <a> { s } </a>;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getXML");
+ assertNotNull(invoker);
+
+ Object xml = invoker.invoke(new Object[] { "petra" });
+ assertNotNull(xml);
+ assertTrue(xml instanceof OMElement);
+ assertEquals("<a>petra</a>", ((OMElement) xml).toString());
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfigTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfigTestCase.java
new file mode 100644
index 0000000000..8975dbaeac
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoSCAConfigTestCase.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.model.Scope;
+
+public class RhinoSCAConfigTestCase extends TestCase {
+
+ public void testJavaInteface() {
+ RhinoScript rs = new RhinoScript("javaInterface", "SCA = { javaInterface : 'Test' }");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals("Test", scaConfig.getJavaInterface());
+ }
+
+ public void testWSDLLocation() {
+ RhinoScript rs = new RhinoScript("wsdlLocation", "SCA = { wsdlLocation : 'Test' }");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals("Test", scaConfig.getWSDLLocation());
+ }
+
+ public void testWSDLNamespace() {
+ RhinoScript rs = new RhinoScript("wsdlNamespace", "SCA = { wsdlNamespace : 'Test' }");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals("Test", scaConfig.getWSDLNamespace());
+ }
+
+ public void testWSDLPortType() {
+ RhinoScript rs = new RhinoScript("wsdlPortType", "SCA = { wsdlPortType : 'Test' }");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals("Test", scaConfig.getWSDLPortType());
+ }
+
+ public void testScopeStateless() {
+ RhinoScript rs = new RhinoScript("testScopeStateless", "SCA = { scope : 'stateless', javaInterface : 'helloworld.HelloWorldService'}");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals(Scope.STATELESS, scaConfig.getScope());
+ }
+
+ public void testScopeComposite() {
+ RhinoScript rs = new RhinoScript("testScopeComposite", "SCA = { scope : 'composite', javaInterface : 'helloworld.HelloWorldService'}");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals(Scope.COMPOSITE, scaConfig.getScope()); // TODO
+ }
+
+ public void testScopeConversational() {
+ RhinoScript rs = new RhinoScript("testScopeConversational", "SCA = { scope : 'conversational', javaInterface : 'helloworld.HelloWorldService'}");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals(Scope.SESSION, scaConfig.getScope());
+ }
+
+ public void testScopeRequest() {
+ RhinoScript rs = new RhinoScript("testScopeRequest", "SCA = { scope : 'request', javaInterface : 'helloworld.HelloWorldService'}");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(scaConfig.hasSCAConfig());
+ assertEquals(Scope.REQUEST, scaConfig.getScope());
+ }
+
+ public void testBadScope() {
+ RhinoScript rs = new RhinoScript("testScopeStateless", "SCA = { scope : 'rubbish', javaInterface : 'helloworld.HelloWorldService'}");
+ try {
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ fail("expecting bad scope exception: " + scaConfig);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ public void testNoConfig() {
+ RhinoScript rs = new RhinoScript("javaInterface", "");
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ assertTrue(!scaConfig.hasSCAConfig());
+ }
+
+ public void testNoService() {
+ RhinoScript rs = new RhinoScript("javaInterface", "SCA = {}");
+ try {
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ fail("expecting no service exception: " + scaConfig);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ public void testDupicateInteface() {
+ RhinoScript rs = new RhinoScript("javaInterface", "SCA = { javaInterface : 'Test', wsdlLocation : 'Test' }");
+ try {
+ RhinoSCAConfig scaConfig = rs.getSCAConfig();
+ fail("expecting multiple service exception: " + scaConfig);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstanceTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstanceTestCase.java
new file mode 100644
index 0000000000..76d6c7c49d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstanceTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the RhinoScriptInstance
+ */
+public class RhinoScriptInstanceTestCase extends TestCase {
+
+ public RhinoScriptInstanceTestCase() {
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testInvokeFunction() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getPetra() {return 'petra';}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ assertEquals("petra", instance.invokeFunction("getPetra", new Object[0]));
+ }
+
+ public void testCreateRhinoFunctionInvoker() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getPetra() {return 'petra';}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ RhinoFunctionInvoker invoker = instance.createRhinoFunctionInvoker("getPetra");
+ assertNotNull(invoker);
+ assertEquals("petra", invoker.invoke(new Object[0]));
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptTestCase.java
new file mode 100644
index 0000000000..ab684c39ce
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the RhinoScript
+ */
+public class RhinoScriptTestCase extends TestCase {
+
+ public RhinoScriptTestCase() {
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testSimpleConstructor() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getPetra() {return 'petra';}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ assertEquals("petra", instance.invokeFunction("getPetra", new Object[0]));
+ }
+
+ public void testFullConstructor() {
+ ClassLoader cl = getClass().getClassLoader();
+ Map<String, Object> contexts = new HashMap<String, Object>();
+ contexts.put("name", "petra");
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getName() {return name;}", contexts, cl);
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ assertEquals("petra", instance.invokeFunction("getName", new Object[0]));
+ }
+
+ public void testCreateInstance() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getPetra() {return 'petra';}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ assertNotNull(instance);
+ }
+
+ public void testCreateInstanceWithContext() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getName() {return name;}");
+ Map<String, Object> contexts = new HashMap<String, Object>();
+ contexts.put("name", "petra");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance(contexts);
+ assertEquals("petra", instance.invokeFunction("getName", new Object[0]));
+ }
+
+ public void testDefaultResponseType() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getX() {return 42;}");
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ assertEquals("42", instance.invokeFunction("getX", new Object[0]));
+ }
+
+ public void testSetResponseType() {
+ RhinoScript rhinoScript = new RhinoScript("foo", "function getX() {return 42;}");
+ rhinoScript.setResponseClass("getX", Integer.class);
+ RhinoScriptInstance instance = rhinoScript.createRhinoScriptInstance();
+ Object x = instance.invokeFunction("getX", new Object[0], Integer.class);
+ assertTrue(x instanceof Integer);
+ assertEquals(new Integer(42), x);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGeneratorTestCase.java b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGeneratorTestCase.java
new file mode 100644
index 0000000000..15752bdaa1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/java/org/apache/tuscany/container/javascript/utils/xmlfromxsd/XMLfromXSDGeneratorTestCase.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.javascript.utils.xmlfromxsd;
+
+import junit.framework.TestCase;
+
+public class XMLfromXSDGeneratorTestCase extends TestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*public void testXMLInstance_SDO_based_1()
+ {
+ String[] arguments = new String[] { "-xsd", "sequences.xsd",
+ "-st", "MixedQuote",
+ "-stn", "http://www.example.com/sequences",
+ "-o", "target/xmlFromxsd-source",
+ "-of", "sequences_sdo.xml"
+ };
+
+ XMLfromXSDGenerator.main(arguments);
+ //File file = new File("target/java2wsdl-source/CustomerValue.wsdl");
+ //assertTrue(file.exists() && file.isFile());
+ }
+
+ public void testXMLInstance_SDO_based_2()
+ {
+ try
+ {
+ XMLfromXSDConfiguration config = new XMLfromXSDConfiguration();
+ config.setXsdFileName("interopdoc.wsdl");
+ config.setSchemaTypeName("ComplexDocument");
+ config.setSchemaTypeNamespaceURI("http://soapinterop.org/");
+ config.setXmlOutputLocation("target/xmlFromxsd-source");
+ config.setXmlFileName("interopdoc_sdo.xml");
+
+ XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.SDO_BASED).generateXML(config);
+ //XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config);
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void testXMLInstance_SDO_based_3()
+ {
+ try
+ {
+ XMLfromXSDConfiguration config = new XMLfromXSDConfiguration();
+ config.setXsdFileName("helloworld.wsdl");
+ //config.setSchemaTypeName("getGreetings");
+ config.setSchemaTypeName("ComplexGreetings");
+ config.setSchemaTypeNamespaceURI("http://helloworldaxis.samples.tuscany.apache.org");
+ config.setXmlOutputLocation("target/xmlFromxsd-source");
+ config.setXmlFileName("helloworld_sdo.xml");
+
+ XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.SDO_BASED).generateXML(config);
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }*/
+
+ public void testXMLInstance_XB_based_1() {
+ String[] arguments = new String[] { "-xsd", "src/test/resources/sequences.xsd", "-st", "mixedStockQuote", "-stn",
+ "http://www.example.com/sequences", "-o", "target/xmlFromxsd-source", "-of", "sequences_xb.xml" };
+
+ XMLfromXSDGenerator.generatorType = XMLGenerator.XMLBEANS_BASED;
+ XMLfromXSDGenerator.main(arguments);
+ /*
+ * File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); assertTrue(file.exists() && file.isFile());
+ */
+ }
+
+ public void testXMLInstance_XB_based_2() {
+ try {
+ XMLfromXSDConfiguration config = new XMLfromXSDConfiguration();
+ config.setXsdFileName("interopdoc.wsdl");
+ config.setSchemaTypeName("ComplexDocument");
+ config.setSchemaTypeNamespaceURI("http://soapinterop.org/");
+ config.setXmlOutputLocation("target/xmlFromxsd-source");
+ config.setXmlFileName("interopdoc_xb.xml");
+
+ XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void testXMLInstance_XB_based_3() {
+ try {
+ XMLfromXSDConfiguration config = new XMLfromXSDConfiguration();
+ config.setXsdFileName("org/apache/tuscany/container/javascript/rhino/helloworld.wsdl");
+ // config.setXsdFileName("helloworld.wsdl");
+ config.setSchemaTypeName("getGreetings");
+ // config.setSchemaTypeName("ComplexGreetings");
+ config.setSchemaTypeNamespaceURI("http://helloworld");
+ config.setXmlOutputLocation("target/xmlFromxsd-source");
+ config.setXmlFileName("helloworld_xb.xml");
+
+ XMLGeneratorFactory.getInstance().createGenerator(XMLGenerator.XMLBEANS_BASED).generateXML(config);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/AccountService.wsdl b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..2a56a3c496
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/AccountService.wsdl
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/Account/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/Account/"
+ targetNamespace="http://www.bigbank.com/Account/"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/Account/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.bigbank.com/Account/"
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="org.apache.tuscany.samples.bigbank.account">
+
+ <xsd:element name="getAccountReportWrapped0">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped0Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrapped1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped1Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrappedN">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="customerID2" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrappedNResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportBare0" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare0Response" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Simple" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare1SimpleResponse" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Complex" type="account:AccountRequest"/>
+ <xsd:element name="getAccountReportBare1ComplexResponse" type="account:AccountReport"/>
+
+ <xsd:complexType name="AccountRequest">
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string"/>
+ <xsd:attribute name="accountType" type="xsd:string"/>
+ <xsd:attribute name="balance" type="xsd:float"/>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportWrapped0Request">
+ <wsdl:part element="account:getAccountReportWrapped0" name="getAccountReportWrapped0Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped0Response">
+ <wsdl:part element="account:getAccountReportWrapped0Response" name="getAccountReportWrapped0Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrapped1Request">
+ <wsdl:part element="account:getAccountReportWrapped1" name="getAccountReportWrapped1Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped1Response">
+ <wsdl:part element="account:getAccountReportWrapped1Response" name="getAccountReportWrapped1Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrappedNRequest">
+ <wsdl:part element="account:getAccountReportWrappedN" name="getAccountReportWrappedNRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrappedNResponse">
+ <wsdl:part element="account:getAccountReportWrappedNResponse" name="getAccountReportWrappedNResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare0Request">
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare0Response">
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1SimpleRequest">
+ <wsdl:part element="account:getAccountReportBare1Simple" name="getAccountReportBare1SimpleRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1SimpleResponse">
+ <wsdl:part element="account:getAccountReportBare1SimpleResponse" name="getAccountReportBare1SimpleResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1ComplexRequest">
+ <wsdl:part element="account:getAccountReportBare1Complex" name="getAccountReportBare1ComplexRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1ComplexResponse">
+ <wsdl:part element="account:getAccountReportBare1ComplexResponse" name="getAccountReportBare1ComplexResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Account_Service">
+ <wsdl:operation name="getAccountReportWrapped0">
+ <wsdl:input message="tns:getAccountReportWrapped0Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <wsdl:input message="tns:getAccountReportWrapped1Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped1Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <wsdl:input message="tns:getAccountReportWrappedNRequest"/>
+ <wsdl:output message="tns:getAccountReportWrappedNResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <wsdl:input message="tns:getAccountReportBare0Request"/>
+ <wsdl:output message="tns:getAccountReportBare0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <wsdl:input message="tns:getAccountReportBare1SimpleRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1SimpleResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <wsdl:input message="tns:getAccountReportBare1ComplexRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1ComplexResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:Account_Service">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReportWrapped0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped1"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrappedN"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Simple"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Complex"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:8080/sample-account/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/interopdoc.wsdl b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/interopdoc.wsdl
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://soapinterop.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/">
+
+ <xsd:element name="SingleTag">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="SingleTag"/>
+ <xsd:element name="SingleTagResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SimpleDocument">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="SimpleDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ComplexDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ComplexDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/>
+ </xsd:sequence>
+ <xsd:attribute name="AnAttribute" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfSimpleDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ChildDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ComplexDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+
+ </types>
+
+ <message name="SingleTagSoapIn">
+ <part name="parameters" element="tns:SingleTag"/>
+ </message>
+ <message name="SingleTagSoapOut">
+ <part name="outputDoc" element="tns:SingleTagResponse"/>
+ </message>
+ <message name="SimpleDocumentSoapIn">
+ <part name="parameters" element="tns:SimpleDocument"/>
+ </message>
+ <message name="SimpleDocumentSoapOut">
+ <part name="outputDoc" element="tns:SimpleDocumentResponse"/>
+ </message>
+ <message name="ComplexDocumentSoapIn">
+ <part name="parameters" element="tns:ComplexDocument"/>
+ </message>
+ <message name="ComplexDocumentSoapOut">
+ <part name="outputDoc" element="tns:ComplexDocumentResponse"/>
+ </message>
+
+ <portType name="DocTestPortType">
+
+ <operation name="SingleTag">
+ <input message="tns:SingleTagSoapIn"/>
+ <output message="tns:SingleTagSoapOut"/>
+ </operation>
+ <operation name="SimpleDocument">
+ <input message="tns:SimpleDocumentSoapIn"/>
+ <output message="tns:SimpleDocumentSoapOut"/>
+ </operation>
+ <operation name="ComplexDocument">
+ <input message="tns:ComplexDocumentSoapIn"/>
+ <output message="tns:ComplexDocumentSoapOut"/>
+ </operation>
+
+ </portType>
+
+ <binding name="doc_test_binding" type="tns:DocTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="SingleTag">
+ <soap:operation soapAction="http://soapinterop.org/SingleTag"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="SimpleDocument">
+ <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="ComplexDocument">
+ <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="interopDocSvc">
+
+ <port name="interopDocPort" binding="tns:doc_test_binding">
+ <soap:address location="http://www.whitemesa.net/interopdoc"/>
+ </port>
+
+ </service>
+
+</definitions>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.componentType b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.componentType
new file mode 100644
index 0000000000..21cec12730
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.componentType
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+</componentType>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.js
new file mode 100644
index 0000000000..520153329e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/HelloWorld.js
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 sayHello(s) {
+ return "Hello " + s;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/IntrospectableHelloWorld.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/IntrospectableHelloWorld.js
new file mode 100644
index 0000000000..2f6b7e0675
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/IntrospectableHelloWorld.js
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+SCA = {
+ 'javaInterface' : 'helloworld.HelloWorldService'
+}
+
+function sayHello(s) {
+ return "Hello " + s;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/compositeScope.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/compositeScope.js
new file mode 100644
index 0000000000..4684b89e66
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/compositeScope.js
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+SCA = {
+ scope : 'composite',
+ javaInterface : 'helloworld.HelloWorldService'
+}
+
+x = 0;
+
+function sayHello(s) {
+ x = x + 1;
+ return x;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.componentType b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.componentType
new file mode 100644
index 0000000000..1159fd8c65
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.componentType
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+<!-- <interface.wsdl interface="http://integration.rhino.container.tuscany.apache.org#HelloWorld"/> -->
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+
+ <reference name="extHelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </reference>
+
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.js
new file mode 100644
index 0000000000..3e9c00fcb9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/e4x.js
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function sayE4XHello(xmlIn) {
+
+ var greeting = "e4xHello " + xmlIn..*::name;
+ var xmlOut = getXmlObject("http://helloworld","getGreetingsResponse");
+
+ var ns = new Namespace("http://helloworld");
+ xmlOut.ns::getGreetingsReturn = greeting;
+
+ return xmlOut;
+}
+
+
+
+ function sayHello(name) {
+ //create XML Request Object
+ var xmlIn = getXmlObject("http://helloworld","getGreetings");
+ var ns = new Namespace("http://helloworld");
+ xmlIn.ns::name = name + " thro e4x reference";
+
+ //invoke service thro service reference and obtain XML Response
+ var xmlOut = extHelloWorldService.sayE4XHello(xmlIn);
+
+ //extract the content of response XML and return as string
+ var greeting = "" + xmlOut..*::getGreetingsReturn;
+ return greeting;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/helloworld.scdl b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/helloworld.scdl
new file mode 100644
index 0000000000..8ddd4fe5c4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/helloworld.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:js="http://tuscany.apache.org/xmlns/js/1.0"
+
+ name="HelloWorldComposite">
+
+ <component name="HelloWorldComponent">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/HelloWorld.js"/>
+ </component>
+
+ <component name="IntrospectableHelloWorldComponent">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/IntrospectableHelloWorld.js"/>
+ </component>
+
+ <component name="HelloWorldComponentE4X">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/e4x.js"/>
+ <reference name="extHelloWorldService" target="HelloWorldJavaReference">HelloWorldJavaReference</reference>
+ </component>
+
+ <component name="HelloWorldJavaReference">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ </component>
+
+ <component name="HelloWorldProperty">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/propertyTest.js"/>
+ <property name="GREETING">Kia ora</property>
+ </component>
+
+ <component name="HelloWorldPropertyDefault">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/propertyTest.js"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.componentType b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.componentType
new file mode 100644
index 0000000000..3d21bce090
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+
+ <property name="GREETING" type="xsd:string">Hi</property>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.js
new file mode 100644
index 0000000000..96e21d0c75
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/propertyTest.js
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 sayHello(s) {
+ return GREETING + ' ' + s;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/requestScope.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/requestScope.js
new file mode 100644
index 0000000000..bf8f840b91
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/requestScope.js
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SCA = {
+ scope : 'request',
+ javaInterface : 'helloworld.HelloWorldService'
+}
+
+x = 0;
+
+function sayHello(s) {
+ x = x + 1;
+ return x;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/scopeTest.scdl b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/scopeTest.scdl
new file mode 100644
index 0000000000..58ac886ec4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/scopeTest.scdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:js="http://tuscany.apache.org/xmlns/js/1.0"
+
+ name="HelloWorldComposite">
+
+ <component name="StatelessComponent">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/statelessScope.js"/>
+ </component>
+
+ <!-- component name="RequestComponent">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/requestScope.js"/>
+ </component -->
+
+ <!-- component name="CompositeScopeComponent">
+ <js:implementation.js script="org/apache/tuscany/container/javascript/function/compositeScope.js"/>
+ </component -->
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/statelessScope.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/statelessScope.js
new file mode 100644
index 0000000000..21f5104859
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/function/statelessScope.js
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+SCA = {
+ scope : 'stateless',
+ javaInterface : 'helloworld.HelloWorldService'
+}
+
+x = 0;
+
+function sayHello(s) {
+ x = x + 1;
+ return x;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/mock/test.js b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/mock/test.js
new file mode 100644
index 0000000000..ef2694b475
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/mock/test.js
@@ -0,0 +1 @@
+//Test Script \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl
new file mode 100644
index 0000000000..67067f044a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/implementation-javascript/container/src/test/resources/sequences.xsd b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/sequences.xsd
new file mode 100644
index 0000000000..a565f3fa65
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/container/src/test/resources/sequences.xsd
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<xsd:schema xmlns:seq="http://www.example.com/sequences"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/sequences">
+
+ <xsd:element name="mixedStockQuote" type="seq:MixedQuote" />
+ <xsd:element name="rc" type="seq:RepeatingChoice" />
+ <xsd:element name="mrc" type="seq:MixedRepeatingChoice" />
+ <xsd:element name="rc2" type="seq:TwoRCs" />
+ <xsd:element name="mrc2" type="seq:TwoRCsMixed" />
+
+
+
+ <xsd:complexType mixed="true" name="MixedQuote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string" />
+ <xsd:element name="companyName" type="xsd:string" />
+ <xsd:element name="price" type="xsd:decimal" />
+ <xsd:element name="open1" type="xsd:decimal" />
+ <xsd:element name="high" type="xsd:decimal" />
+ <xsd:element name="low" type="xsd:decimal" />
+ <xsd:element name="volume" type="xsd:double" />
+ <xsd:element name="change1" type="xsd:double" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="quotes" type="seq:MixedQuote" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="RepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType mixed="true" name="MixedRepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="TwoRCs">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType mixed="true" name="TwoRCsMixed">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/sandbox/old/contrib/implementation-javascript/pom.xml.off b/sandbox/old/contrib/implementation-javascript/pom.xml.off
new file mode 100644
index 0000000000..a811b1a287
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/pom.xml.off
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.javascript</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany JavaScript Extension</name>
+
+ <modules>
+ <module>container</module>
+ <module>samples</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R5</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId> <!-- Reqd for E4X -->
+ <version>2.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-javascript/samples/helloworld/pom.xml.off
new file mode 100644
index 0000000000..9fc6499349
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/pom.xml.off
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.javascript.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworld-javascript</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany JavaScript helloworld Sample</name>
+ <description>A helloworld sample using a single SCA JavaScript component</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.javascript</groupId>
+ <artifactId>tuscany-javascript</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..257270f65a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+ public static void main(String[] args) throws Exception {
+
+ HelloWorldService helloWorldService = CurrentCompositeContext.getContext().locateService(HelloWorldService.class,
+ "HelloWorldComponent");
+
+ System.out.println(helloWorldService.sayHello(args.length < 1 ? "world" : args[0]));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..bfea460664
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+public interface HelloWorldService {
+
+ String sayHello(String s);
+
+}
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..5acb3a42d8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.js b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.js
new file mode 100644
index 0000000000..928251bca2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/HelloWorld.js
@@ -0,0 +1,3 @@
+function sayHello(s) {
+ return "Hello " + s;
+}
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/LICENSE.txt b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..25d78feeac
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,1277 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE TUSCANY SUBCOMPONENTS:
+
+The Apache Tuscany distribution includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+For the Eclipse Modeling Framework component and the Celtix binding:
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript container component:
+
+Mozilla Public License 1.1 (MPL 1.1)
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original Code,
+prior Modifications used by a Contributor, and the Modifications made by that
+particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+combination of the Original Code and Modifications, in each case including
+portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+accepted in the software development community for the electronic transfer of
+data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified as
+the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+extent possible, whether at the time of the initial grant or subsequently
+acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+substance or structure of either the Original Code or any previous
+Modifications. When Covered Code is released as a series of files, a
+Modification is:
+ A. Any addition to or deletion from the contents of a file
+containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+which is described in the Source Code notice required by Exhibit A as Original
+Code, and which, at the time of its release under this License is not already
+Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+hereafter acquired, including without limitation, method, process, and
+apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+making modifications to it, including all modules it contains, plus any
+associated interface definition files, scripts used to control compilation and
+installation of an Executable, or source code differential comparisons against
+either the Original Code or another well known, available Covered Code of the
+Contributor's choice. The Source Code can be in a compressed or archival form,
+provided the appropriate decompression or de-archiving software is widely
+available for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+exercising rights under, and complying with all of the terms of, this License
+or a future version of this License issued under Section 6.1. For legal
+entities, "You" includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this definition, "control"
+means (a) the power, direct or indirect, to cause the direction or management
+of such entity, whether by contract or otherwise, or (b) ownership of more
+than fifty percent (50%) of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property claims:
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Initial Developer to use, reproduce, modify, display,
+perform, sublicense and distribute the Original Code (or portions thereof)
+with or without Modifications, and/or as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or selling
+of Original Code, to make, have made, use, practice, sell, and offer for sale,
+and/or otherwise dispose of the Original Code (or portions thereof).
+ (c) the licenses granted in this Section 2.1(a) and
+(b) are effective on the date Initial Developer first distributes Original
+Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+granted: 1) for code that You delete from the Original Code; 2) separate from
+the Original Code; or 3) for infringements caused by: i) the modification of
+the Original Code or ii) the combination of the Original Code with other
+software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Contributor, to use, reproduce, modify, display,
+perform, sublicense and distribute the Modifications created by such
+Contributor (or portions thereof) either on an unmodified basis, with other
+Modifications, as Covered Code and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+of Modifications made by that Contributor either alone and/or in combination
+with its Contributor Version (or portions of such combination), to make, use,
+sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications
+made by that Contributor (or portions thereof); and 2) the combination of
+Modifications made by that Contributor with its Contributor Version (or
+portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+effective on the date Contributor first makes Commercial Use of the Covered
+Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+granted: 1) for any code that Contributor has deleted from the Contributor
+Version; 2) separate from the Contributor Version; 3) for infringements
+caused by: i) third party modifications of Contributor Version or ii) the
+combination of Modifications made by that Contributor with other software
+(except as part of the Contributor Version) or other devices; or 4) under
+Patent Claims infringed by Covered Code in the absence of Modifications made
+by that Contributor.
+
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+governed by the terms of this License, including without limitation Section
+2.2. The Source Code version of Covered Code may be distributed only under the
+terms of this License or a future version of this License released under
+Section 6.1, and You must include a copy of this License with every copy of
+the Source Code You distribute. You may not offer or impose any terms on any
+Source Code version that alters or restricts the applicable version of this
+License or the recipients' rights hereunder. However, You may include an
+additional document offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+made available in Source Code form under the terms of this License either on
+the same media as an Executable version or via an accepted Electronic
+Distribution Mechanism to anyone to whom you made an Executable version
+available; and if made available via Electronic Distribution Mechanism, must
+remain available for at least twelve (12) months after the date it initially
+became available, or at least six (6) months after a subsequent version of
+that particular Modification has been made available to such recipients. You
+are responsible for ensuring that the Source Code version remains available
+even if the Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+file documenting the changes You made to create that Covered Code and the date
+of any change. You must include a prominent statement that the Modification is
+derived, directly or indirectly, from Original Code provided by the Initial
+Developer and including the name of the Initial Developer in (a) the Source
+Code, and (b) in any notice in an Executable version or related documentation
+in which You describe the origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+intellectual property rights is required to exercise the rights granted by
+such Contributor under Sections 2.1 or 2.2, Contributor must include a text
+file with the Source Code distribution titled "LEGAL" which describes the
+claim and the party making the claim in sufficient detail that a recipient
+will know whom to contact. If Contributor obtains such knowledge after the
+Modification is made available as described in Section 3.2, Contributor shall
+promptly modify the LEGAL file in all copies Contributor makes available
+thereafter and shall take other steps (such as notifying appropriate mailing
+lists or newsgroups) reasonably calculated to inform those who received the
+Covered Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+interface and Contributor has knowledge of patent licenses which are
+reasonably necessary to implement that API, Contributor must also include this
+information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+Section 3.4(a) above, Contributor believes that Contributor's Modifications
+are Contributor's original creation(s) and/or Contributor has sufficient
+rights to grant the rights conveyed by this License.
+
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+Code. If it is not possible to put such notice in a particular Source Code
+file due to its structure, then You must include such notice in a location
+(such as a relevant directory) where a user would be likely to look for such a
+notice. If You created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also duplicate
+this License in any documentation for the Source Code where You describe
+recipients' rights or ownership rights relating to Covered Code. You may
+choose to offer, and to charge a fee for, warranty, support, indemnity or
+liability obligations to one or more recipients of Covered Code. However, You
+may do so only on Your own behalf, and not on behalf of the Initial Developer
+or any Contributor. You must make it absolutely clear than any such warranty,
+support, indemnity or liability obligation is offered by You alone, and You
+hereby agree to indemnify the Initial Developer and every Contributor for any
+liability incurred by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+requirements of Section 3.1-3.5 have been met for that Covered Code, and if
+You include a notice stating that the Source Code version of the Covered Code
+is available under the terms of this License, including a description of how
+and where You have fulfilled the obligations of Section 3.2. The notice must
+be conspicuously included in any notice in an Executable version, related
+documentation or collateral in which You describe recipients' rights relating
+to the Covered Code. You may distribute the Executable version of Covered Code
+or ownership rights under a license of Your choice, which may contain terms
+different from this License, provided that You are in compliance with the
+terms of this License and that the license for the Executable version does not
+attempt to limit or alter the recipient's rights in the Source Code version
+from the rights set forth in this License. If You distribute the Executable
+version under a different license You must make it absolutely clear that any
+terms which differ from this License are offered by You alone, not by the
+Initial Developer or any Contributor. You hereby agree to indemnify the
+Initial Developer and every Contributor for any liability incurred by the
+Initial Developer or such Contributor as a result of any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+not governed by the terms of this License and distribute the Larger Work as a
+single product. In such a case, You must make sure the requirements of this
+License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Code due to statute,
+judicial order, or regulation then You must: (a) comply with the terms of this
+License to the maximum extent possible; and (b) describe the limitations and
+the code they affect. Such description must be included in the LEGAL file
+described in Section 3.4 and must be included with all distributions of the
+Source Code. Except to the extent prohibited by statute or regulation, such
+description must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has attached
+the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+and/or new versions of the License from time to time. Each version will be
+given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+License, You may always continue to use it under the terms of that version.
+You may also choose to use such Covered Code under the terms of any subsequent
+version of the License published by Netscape. No one other than Netscape has
+the right to modify the terms applicable to Covered Code created under this
+License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+only do in order to apply it to code which is not already Covered Code
+governed by this License), You must (a) rename Your license so that the
+phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or
+any confusingly similar phrase do not appear in your license (except to note
+that your license differs from this License) and (b) otherwise make it clear
+that Your version of the license contains terms which differ from the Mozilla
+Public License and Netscape Public License. (Filling in the name of the
+Initial Developer, Original Code or Contributor in the notice described in
+Exhibit A shall not of themselves be deemed to be modifications of this
+License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+automatically if You fail to comply with terms herein and fail to cure such
+breach within 30 days of becoming aware of the breach. All sublicenses to the
+Covered Code which are properly granted shall survive any termination of this
+License. Provisions which, by their nature, must remain in effect beyond the
+termination of this License shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+claim (excluding declatory judgment actions) against Initial Developer or a
+Contributor (the Initial Developer or Contributor against whom You file such
+action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+infringes any patent, then any and all rights granted by such Participant to
+You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+from Participant terminate prospectively, unless if within 60 days after
+receipt of notice You either: (i) agree in writing to pay Participant a
+mutually agreeable reasonable royalty for Your past and future use of
+Modifications made by such Participant, or (ii) withdraw Your litigation claim
+with respect to the Contributor Version against such Participant. If within
+60 days of notice, a reasonable royalty and payment arrangement are not
+mutually agreed upon in writing by the parties or the litigation claim is not
+withdrawn, the rights granted by Participant to You under Sections 2.1 and/or
+2.2 automatically terminate at the expiration of the 60 day notice period
+specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+Contributor Version, directly or indirectly infringes any patent, then any
+rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are
+revoked effective as of the date You first made, used, sold, distributed, or
+had made, Modifications made by that Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+alleging that such Participant's Contributor Version directly or indirectly
+infringes any patent where such claim is resolved (such as by license or
+settlement) prior to the initiation of patent infringement litigation, then
+the reasonable value of the licenses granted by such Participant under
+Sections 2.1 or 2.2 shall be taken into account in determining the amount or
+value of any payment or license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above, all
+end user license agreements (excluding distributors and resellers) which have
+been validly granted by You or any distributor hereunder prior to termination
+shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY
+SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
+WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
+EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
+DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
+OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
+EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in 48
+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and
+"commercial computer software documentation," as such terms are used in 48
+C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject matter
+hereof. If any provision of this License is held to be unenforceable, such
+provision shall be reformed only to the extent necessary to make it
+enforceable. This License shall be governed by California law provisions
+(except to the extent applicable law, if any, provides otherwise), excluding
+its conflict-of-law provisions. With respect to disputes in which at least one
+party is a citizen of, or an entity chartered or registered to do business in
+the United States of America, any litigation relating to this License shall be
+subject to the jurisdiction of the Federal Courts of the Northern District of
+California, with venue lying in Santa Clara County, California, with the
+losing party responsible for costs, including without limitation, court costs
+and reasonable attorneys' fees and expenses. The application of the United
+Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly, out of its
+utilization of rights under this License and You agree to work with Initial
+Developer and Contributors to distribute such responsibility on an equitable
+basis. Nothing herein is intended or shall be deemed to constitute any
+admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits
+you to utilize portions of the Covered Code under Your choice of the MPL or
+the alternative licenses, if any, specified by the Initial Developer in the
+file described in Exhibit A.
+
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+language governing rights and
+ limitations under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+Portions created by
+ ______________________ are Copyright (C) ______
+_______________________. All Rights
+ Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms of
+the _____ license (the [___] License), in which case the provisions of
+[______] License are applicable instead of those above. If you wish to allow
+use of your version of this file only under the terms of the [____] License
+and not to allow others to use your version of this file under the MPL,
+indicate your decision by deleting the provisions above and replace them
+with the notice and other provisions required by the [___] License. If you do
+not delete the provisions above, a recipient may use your version of this file
+under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+the notices in the Source Code files of the Original Code. You should use the
+text of this Exhibit A rather than the text found in the Original Code Source
+Code for Your Modifications.]
+
+
+===============================================================================
+
+For the JAX-WS Reference Implementation component:
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/NOTICE b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache Tuscany distribution. ==
+=========================================================================
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Celtix project (http://celtix.objectweb.org/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..2e8afc5339
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:js="http://tuscany.apache.org/xmlns/js/1.0"
+ name="HelloWorldComposite">
+
+ <component name="HelloWorldComponent">
+ <js:implementation.js script="HelloWorld.js"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..77a51bb7e3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.net.URL;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class HelloWorldTestCase extends SCATestCase {
+
+ private HelloWorldService helloWorldService;
+
+ protected void setUp() throws Exception {
+ URL scdl = getClass().getClassLoader().getResource("META-INF/sca/js.system.scdl");
+ addExtension("JavaScriptContainer", scdl);
+ setApplicationSCDL(HelloWorldService.class, "META-INF/sca/default.scdl");
+ super.setUp();
+
+ CompositeContext context = CurrentCompositeContext.getContext();
+ helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public void testHelloWorld() throws Exception {
+ assertEquals(helloWorldService.sayHello("petra"), "Hello petra");
+ }
+}
diff --git a/sandbox/old/contrib/implementation-javascript/samples/pom.xml.off b/sandbox/old/contrib/implementation-javascript/samples/pom.xml.off
new file mode 100644
index 0000000000..059d361a8b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-javascript/samples/pom.xml.off
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.javascript</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.javascript.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the JavaScript extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${specVersion}</artifactId>
+ <version>${scaVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-ruby/container/NOTICE.txt b/sandbox/old/contrib/implementation-ruby/container/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-ruby/container/pom.xml.off b/sandbox/old/contrib/implementation-ruby/container/pom.xml.off
new file mode 100644
index 0000000000..ab0679f3b8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/pom.xml.off
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.ruby</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-ruby</artifactId>
+ <name>Apache Tuscany Ruby Container</name>
+ <description>Apache Tuscany Ruby Container</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby</artifactId>
+ <version>0.9.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java
new file mode 100644
index 0000000000..435b2a12dc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+import org.apache.tuscany.container.ruby.rubyscript.RubyScriptInstance;
+
+/**
+ * The Ruby component implementation.
+ */
+public class RubyComponent extends AtomicComponentExtension {
+
+ private final Map<String, Object> properties;
+
+ private RubyScript rubyScript;
+
+ private String rubyClassName;
+
+ public RubyComponent(String name,
+ RubyScript rubyScript,
+ String rubyClassName,
+ Map<String, Object> propValues,
+ CompositeComponent parent,
+ WireService wireService,
+ WorkContext workContext,
+ ExecutionMonitor monitor) {
+ super(name, parent, wireService, workContext, null, monitor, 0);
+
+ this.rubyScript = rubyScript;
+ this.rubyClassName = rubyClassName;
+ //this.properties = new HashMap<String, Object>();
+ this.properties = propValues;
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+
+ Map<String, Object> context = new HashMap<String, Object>(getProperties());
+
+ for (List<OutboundWire> referenceWires : getOutboundWires().values()) {
+ for (OutboundWire wire : referenceWires) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ Object wireProxy = wireService.createProxy(clazz, wire);
+ //since all types that may be used in the reference interface may not be known to Rhino
+ //using the wireProxy as is will fail result in type conversion exceptions in cases where
+ //Rhino does not know enough of the tpypes used. Hence introduce a interceptor proxy,
+ //with weak typing (java.lang.Object) so that Rhino's call to the proxy succeeds. Then
+ //within this interceptor proxy perform data mediations required to correctly call the
+ //referenced service.
+ Class<?> businessInterface = wire.getServiceContract().getInterfaceClass();
+ RubyReferenceProxy interceptingProxy = new RubyReferenceProxy(businessInterface,
+ wireProxy,
+ rubyScript.getRubyEngine());
+ context.put(wire.getReferenceName(), interceptingProxy.createProxy());
+ }
+ }
+
+ Object instance = rubyScript.createScriptInstance(context, rubyClassName);
+
+ return instance;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ /*Method[] methods = operation.getServiceContract().getInterfaceClass().getMethods();
+ Method method = findMethod(operation,
+ methods);*/
+ return new RubyInvoker(operation.getName(),
+ this,
+ operation.getOutputType().getPhysical().getClass(),
+ callbackWire,
+ workContext,
+ monitor);
+ }
+
+ // TODO: move all the following up to AtomicComponentExtension?
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public RubyScriptInstance getTargetInstance() throws TargetResolutionException {
+ return (RubyScriptInstance) scopeContainer.getInstance(this);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentBuilder.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentBuilder.java
new file mode 100644
index 0000000000..b80ca3e8d5
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentBuilder.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.PropertyValue;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+
+/**
+ * Extension point for creating {@link RubyComponent}s from an assembly configuration
+ */
+public class RubyComponentBuilder extends ComponentBuilderExtension<RubyImplementation> {
+
+ protected Class<RubyImplementation> getImplementationType() {
+ return RubyImplementation.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Component build(CompositeComponent parent,
+ ComponentDefinition<RubyImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+
+ String name = componentDefinition.getName();
+ RubyImplementation implementation = componentDefinition.getImplementation();
+ RubyComponentType componentType = implementation.getComponentType();
+
+ // get list of serviceBindings provided by this component
+ Collection<ServiceDefinition> collection = componentType.getServices().values();
+ List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
+ for (ServiceDefinition serviceDefinition : collection) {
+ services.add(serviceDefinition.getServiceContract().getInterfaceClass());
+ }
+
+ Map<String, Object> propertyValues = new Hashtable<String, Object>();
+ Collection<PropertyValue<?>> propValueSettings = componentDefinition.getPropertyValues().values();
+ for (PropertyValue propertyValue : propValueSettings) {
+ propertyValues.put(propertyValue.getName(),
+ propertyValue.getValueFactory().getInstance());
+ }
+
+ RubyScript rubyScript = implementation.getRubyScript();
+
+ // TODO: have ComponentBuilderExtension pass ScopeContainer in on build method?
+ return new RubyComponent(name,
+ rubyScript,
+ implementation.getRubyClassName(),
+ propertyValues,
+ parent,
+ wireService,
+ workContext,
+ monitor);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentType.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentType.java
new file mode 100644
index 0000000000..2fb50b4c95
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+public class RubyComponentType extends
+ ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+
+ public RubyComponentType() {
+ implementationScope = Scope.STATELESS;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentTypeLoader.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentTypeLoader.java
new file mode 100644
index 0000000000..62e3c9d76a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyComponentTypeLoader.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubySCAConfig;
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RubyComponentTypeLoader extends ComponentTypeLoaderExtension<RubyImplementation> {
+
+ private JavaInterfaceProcessorRegistry processorRegistry;
+
+ public RubyComponentTypeLoader(@Autowire JavaInterfaceProcessorRegistry processorRegistry) {
+ this.processorRegistry = processorRegistry;
+ }
+
+ @Override
+ protected Class<RubyImplementation> getImplementationClass() {
+ return RubyImplementation.class;
+ }
+
+ protected RubyComponentType loadByIntrospection(CompositeComponent parent,
+ ModelObject object,
+ RubyImplementation implementation,
+ DeploymentContext deploymentContext) throws
+ MissingResourceException,
+ InvalidServiceContractException {
+
+ RubyScript rubyScript = implementation.getRubyScript();
+ RubySCAConfig scaConfig = rubyScript.getSCAConfig();
+ if (!scaConfig.hasSCAConfig()) {
+ throw new IllegalArgumentException(
+ "must use either .componentType side file or Ruby Global variable $SCA definition");
+ }
+
+ // FIXME this should be a system service, not instantiated here
+ RubyComponentType componentType = new RubyIntrospector(null, processorRegistry)
+ .introspectScript(scaConfig, rubyScript.getClassLoader());
+
+ return componentType;
+ }
+
+ protected String getResourceName(RubyImplementation implementation) {
+ return implementation.getRubyScript().getScriptName();
+ }
+
+ // TODO: must be possible to move all the following up in to ComponentTypeLoaderExtension
+
+ public void load(CompositeComponent parent,
+ RubyImplementation implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+
+ URL resource = implementation.getRubyScript().getClassLoader().getResource(getSideFileName(implementation));
+ RubyComponentType componentType;
+ if (resource == null) {
+ try {
+ componentType = loadByIntrospection(parent, null, implementation, deploymentContext);
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException("Invalid service contract", e);
+ }
+ } else {
+ componentType = loadFromSidefile(resource, deploymentContext);
+ }
+
+ implementation.setComponentType(componentType);
+
+
+ }
+
+ @SuppressWarnings("unchecked")
+ protected RubyComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) throws LoaderException {
+ // This should be fixed to pass in a RubyComponentType instead of null
+ RubyComponentType componentType = new RubyComponentType();
+ return (RubyComponentType) loaderRegistry.load(null,
+ componentType,
+ url,
+ ComponentType.class,
+ deploymentContext);
+ }
+
+ private String getSideFileName(RubyImplementation implementation) {
+ String baseName = getResourceName(implementation);
+ int lastDot = baseName.lastIndexOf('.');
+ if (lastDot != -1) {
+ baseName = baseName.substring(0,
+ lastDot);
+ }
+ return baseName + ".componentType";
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementation.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementation.java
new file mode 100644
index 0000000000..6f07399d0a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementation.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * Model object for a JavaScript implementation.
+ */
+public class RubyImplementation extends AtomicImplementation<RubyComponentType> {
+
+ private RubyScript rubyScript;
+
+ private String rubyClassName;
+
+ public String getRubyClassName() {
+ return rubyClassName;
+ }
+
+ public void setRubyClassName(String rubyClassName) {
+ this.rubyClassName = rubyClassName;
+ }
+
+ public RubyScript getRubyScript() {
+ return rubyScript;
+ }
+
+ public void setRubyScript(RubyScript rubyScript) {
+ this.rubyScript = rubyScript;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementationLoader.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementationLoader.java
new file mode 100644
index 0000000000..3a2e8a460f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyImplementationLoader.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Loader for handling JavaScript <js:implementation.js> elements.
+ */
+public class RubyImplementationLoader extends LoaderExtension<RubyImplementation> {
+ private static final QName IMPLEMENTATION_RUBY = new QName(
+ "http://tuscany.apache.org/xmlns/rb/1.0", "implementation.rb");
+
+ @Constructor({"registry"})
+ public RubyImplementationLoader(@Autowire
+ LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_RUBY;
+ }
+
+ public RubyImplementation load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+
+ String script = reader.getAttributeValue(null,
+ "script");
+ String rubyClassName = reader.getAttributeValue(null,"class");
+
+ if ( script == null ) {
+ throw new MissingResourceException("No script supplied");
+ }
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+ String source = loadSource(cl,
+ script);
+
+ LoaderUtil.skipToEndElement(reader);
+
+ RubyImplementation implementation = new RubyImplementation();
+ RubyScript rubyScript = new RubyScript(script, source, null, cl);
+ implementation.setRubyScript(rubyScript);
+ implementation.setRubyClassName(rubyClassName);
+ registry.loadComponentType(parent,
+ implementation,
+ deploymentContext);
+ return implementation;
+ }
+
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ URL url = cl.getResource(resource);
+ if (url == null) {
+ throw new MissingResourceException(resource);
+ }
+ InputStream is;
+ try {
+ is = url.openStream();
+ } catch (IOException e) {
+ throw new MissingResourceException(resource, e);
+ }
+ try {
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer,
+ 0,
+ count);
+ }
+ return source.toString();
+ } catch (IOException e) {
+ throw new LoaderException(resource, e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyIntrospector.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyIntrospector.java
new file mode 100644
index 0000000000..427eb79184
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyIntrospector.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubySCAConfig;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Introspects JavaScript files for SCA configuration
+ */
+public class RubyIntrospector {
+
+ private WSDLDefinitionRegistry wsdlRegistry;
+ private JavaInterfaceProcessorRegistry processorRegistry;
+
+ public RubyIntrospector(@Autowire WSDLDefinitionRegistry wsdlRegistry,
+ @Autowire JavaInterfaceProcessorRegistry processorRegistry) {
+ this.wsdlRegistry = wsdlRegistry;
+ this.processorRegistry = processorRegistry;
+ }
+
+ public RubyComponentType introspectScript(RubySCAConfig scaConfig, ClassLoader cl)
+ throws MissingResourceException, InvalidServiceContractException {
+ RubyComponentType componentType = new RubyComponentType();
+ introspectJavaInterface(componentType, cl, scaConfig.getJavaInterface());
+ introspectWSDLInterface(componentType, cl, scaConfig.getWSDLNamespace(), scaConfig.getWSDLPortType(),
+ scaConfig.getWSDLLocation());
+ introspectReferences(componentType, cl, scaConfig.getReferences());
+ introspectProperties(componentType, cl, scaConfig.getProperties());
+ introspectScope(componentType, scaConfig.getScope());
+ return componentType;
+ }
+
+ private void introspectScope(RubyComponentType componentType, Scope scope) {
+ if (scope != null) {
+ componentType.setImplementationScope(scope);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void introspectJavaInterface(ComponentType componentType, ClassLoader cl, String serviceClass)
+ throws MissingResourceException, InvalidServiceContractException {
+ if (serviceClass != null) {
+ ServiceDefinition service = new ServiceDefinition();
+ try {
+ ServiceContract<?> sc = processorRegistry.introspect(Class.forName(serviceClass));
+ service.setServiceContract(sc);
+ service.setName(sc.getInterfaceClass().getSimpleName());
+ componentType.add(service);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Interface not found", e);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void introspectWSDLInterface(ComponentType componentType, ClassLoader cl, String wsdlNamespace,
+ String wsdlPortType, String wsdlLocation) {
+ if (wsdlNamespace == null && wsdlPortType == null && wsdlLocation == null) {
+ return;
+ }
+
+ PortType portType = null;
+ if (wsdlLocation != null) {
+ portType = readWSDLPortType(wsdlNamespace, wsdlPortType, wsdlLocation, portType);
+ } else {
+ portType = getPortType(wsdlNamespace, wsdlPortType);
+ }
+
+ ServiceDefinition service = new ServiceDefinition();
+ WSDLServiceContract wsdlSC = new WSDLServiceContract();
+ wsdlSC.setPortType(portType);
+ service.setServiceContract(wsdlSC);
+ componentType.add(service);
+ }
+
+ private PortType readWSDLPortType(String wsdlNamespace, String wsdlPortType, String wsdlLocation,
+ PortType portType) {
+ Definition wsdlDefinition;
+ try {
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ wsdlDefinition = reader.readWSDL(wsdlLocation.toString());
+ } catch (WSDLException e) {
+ throw new RuntimeException(e);
+
+ }
+ Map portTypes = wsdlDefinition.getPortTypes();
+ for (Iterator i = portTypes.keySet().iterator(); i.hasNext();) {
+ QName portTypeQN = (QName) i.next();
+ if (wsdlNamespace != null) {
+ if (!portTypeQN.getNamespaceURI().equals(wsdlNamespace)) {
+ continue;
+ }
+ }
+ if (wsdlPortType != null) {
+ if (!portTypeQN.getLocalPart().equals(wsdlPortType)) {
+ continue;
+ }
+ }
+ if (portType != null) {
+ throw new RuntimeException("multiple matching portTypes in wsdl: " + wsdlLocation);
+ }
+ portType = (PortType) portTypes.get(portTypeQN);
+ }
+ if (portType == null) {
+ throw new RuntimeException("portType not found in wsdl: " + wsdlLocation);
+ }
+ return portType;
+ }
+
+ private PortType getPortType(String wsdlNamespace, String wsdlPortType) {
+ if (wsdlPortType == null) {
+ throw new IllegalArgumentException("must specify the wsdlPortType in script SCA config");
+ }
+ PortType portType = null;
+ if (wsdlNamespace != null) {
+ QName portTypeQN = new QName(wsdlNamespace.toString(), wsdlPortType.toString());
+ portType = wsdlRegistry.getPortType(portTypeQN);
+ if (portType == null) {
+ throw new IllegalArgumentException("no WSDL registered for portType: " + portTypeQN);
+ }
+ } else {
+ // wsdlRegistry.getPortType(wsdlPortType.toString());
+ if (portType == null) {
+ throw new IllegalArgumentException("no WSDL registered for portType:" + wsdlPortType);
+ }
+ }
+ return portType;
+ }
+
+
+ private void introspectProperties(ComponentType componentType, ClassLoader cl, Map properties) {
+ }
+
+ private void introspectReferences(ComponentType componentType, ClassLoader cl, Map references) {
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java
new file mode 100644
index 0000000000..43caff908d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScriptInstance;
+
+/**
+ * Dispatches to a JavaScript implementation instance
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RubyInvoker extends TargetInvokerExtension {
+
+ private RubyComponent context;
+
+ private String functionName;
+
+ private Class returnType;
+
+ public RubyInvoker(String functionName,
+ RubyComponent context,
+ Class returnType,
+ InboundWire wire,
+ WorkContext workContext,
+ ExecutionMonitor monitor) {
+ super(wire, workContext, monitor);
+ this.functionName = functionName;
+ this.context = context;
+ this.returnType = returnType;
+ }
+
+ /**
+ * Invokes a function on a script instance
+ */
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ RubyScriptInstance target = null;
+ try {
+ target = context.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+
+ }
+ return target.invokeFunction(functionName,
+ (Object[]) payload,
+ returnType);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyRefInvocInterceptor.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyRefInvocInterceptor.java
new file mode 100644
index 0000000000..bf62d1fcab
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyRefInvocInterceptor.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.jruby.IRuby;
+import org.jruby.RubyObject;
+import org.jruby.javasupport.JavaUtil;
+
+/**
+ * This Interceptor encasulates the data mediation required by the JavaScriptReferenceProxy. The
+ * invocation handler of this class traps the javascript reference calls, performs data mediation
+ * and calls then calls the actual referred service. This classes implementation is subject to
+ * review and change when the DataMediation infrastructure of Tuscany is ready.
+ *
+ */
+public class RubyRefInvocInterceptor implements InvocationHandler {
+ private Object actualProxy;
+
+ private Class wireInterface;
+
+ private IRuby rubyEngine;
+
+ RubyRefInvocInterceptor(Object wireProxy, Class wireIfc, IRuby rubyEng) {
+ this.actualProxy = wireProxy;
+ this.wireInterface = wireIfc;
+ this.rubyEngine = rubyEng;
+ }
+
+ public Object invoke(Object arg0, Method method, Object[] args) throws Throwable {
+ if ( method.getName().equals("hashCode"))
+ return new Integer(1);
+
+ Method invokedMethod = getInvokedMethod(method.getName());
+ Object[] tranformedArgs = new Object[args.length];
+ for (int count = 0; count < args.length; ++count) {
+ tranformedArgs[count] = fromRubyToJava(invokedMethod.getParameterTypes()[count], args[count]);
+ }
+
+ Object response = invokedMethod.invoke(actualProxy, tranformedArgs);
+ response = fromJavaToRuby(response);
+ return response;
+ }
+
+ private Method getInvokedMethod(String methodName) {
+ Method[] methods = wireInterface.getMethods();
+
+ for (int count = 0; count < methods.length; ++count) {
+ if (methods[count].getName().equals(methodName)) {
+ return methods[count];
+ }
+ }
+ throw new RuntimeException("Unable to find invocation method");
+ }
+
+ protected Object fromRubyToJava(Class reqArgType, Object rubyArg) throws Exception {
+ Object javaArg = null;
+
+ //for known cases the JRuby runtime handles the conversion before calling the Java objects
+ //so nothing to do. When it cannot convert it simply passed the instance of RubyObject
+ if ( rubyArg instanceof RubyObject ) {
+ //need to deal with this
+ } else {
+ javaArg = rubyArg;
+ }
+
+ return javaArg;
+ }
+
+ protected Object fromJavaToRuby(Object retVal) throws RuntimeException {
+ Object rubyRetVal = JavaUtil.convertJavaToRuby(rubyEngine, retVal, retVal.getClass());
+ return rubyRetVal;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyReferenceProxy.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyReferenceProxy.java
new file mode 100644
index 0000000000..4d91194484
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/RubyReferenceProxy.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jruby.IRuby;
+import org.jruby.RubyException;
+
+import net.sf.cglib.asm.ClassWriter;
+import net.sf.cglib.asm.CodeVisitor;
+import net.sf.cglib.asm.Constants;
+import net.sf.cglib.asm.Type;
+
+/**
+ * This is a proxy that will mediate reference calls from the JavaScript. The mediation code here will be reviewed when the DataMediation
+ * infrastructure is ready. This proxy assmes that there is no verloading of service methods on the reference interface i.e. there are no two service
+ * methods that have the same method name or operation name.
+ */
+public class RubyReferenceProxy {
+
+ private Class interfaze;
+
+ private Object wireProxy;
+
+ private IRuby rubyEngine;
+
+ public RubyReferenceProxy(Class interfaze, Object wireProxy, IRuby rubyEng) {
+ this.interfaze = interfaze;
+ this.wireProxy = wireProxy;
+ this.rubyEngine = rubyEng;
+ }
+
+ public Object createProxy() {
+ try {
+ GenericProxyClassLoader classloader = new GenericProxyClassLoader();
+ final byte[] byteCode = generateGenericInterface(interfaze);
+
+ Class genericInterface = classloader.defineClass(byteCode);
+ InvocationHandler proxyHandler = new RubyRefInvocInterceptor(wireProxy, interfaze, rubyEngine);
+ // return genericInterface.cast(Proxy.newProxyInstance(classloader, new Class[]{genericInterface}, proxyHandler));
+ return Proxy.newProxyInstance(classloader,
+ new Class[]{genericInterface},
+ proxyHandler);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static byte[] generateGenericInterface(Class serviceInterface) {
+ String interfazeName = serviceInterface.getCanonicalName();
+ ClassWriter cw = new ClassWriter(false);
+
+ cw.visit(Constants.V1_5,
+ Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT + Constants.ACC_INTERFACE,
+ interfazeName.replace('.',
+ '/'),
+ "java/lang/Object",
+ null,
+ serviceInterface.getSimpleName() + ".java");
+
+ StringBuffer argsAndReturn = new StringBuffer("(");
+ Method[] methods = serviceInterface.getMethods();
+ for (int count = 0; count < methods.length; ++count) {
+ argsAndReturn = new StringBuffer("(");
+ Class[] paramTypes = methods[count].getParameterTypes();
+ Class returnType = methods[count].getReturnType();
+
+ for (int paramCount = 0; paramCount < paramTypes.length; ++paramCount) {
+ argsAndReturn.append(Type.getType(Object.class));
+ }
+ argsAndReturn.append(")");
+ argsAndReturn.append(Type.getType(Object.class));
+
+ Class[] exceptionTypes = methods[count].getExceptionTypes();
+ String[] exceptions = new String[exceptionTypes.length];
+ for (int excCount = 0; excCount < exceptionTypes.length; ++excCount) {
+ exceptions[excCount] = exceptionTypes[excCount].getName();
+ exceptions[excCount] = exceptions[excCount].replace('.',
+ '/');
+ }
+
+ CodeVisitor cv = cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
+ methods[count].getName(),
+ argsAndReturn.toString(),
+ exceptions,
+ null);
+ cw.visitEnd();
+ }
+
+ cw.visitEnd();
+
+ return cw.toByteArray();
+ }
+
+ private class GenericProxyClassLoader extends ClassLoader {
+ public Class defineClass(byte[] byteArray) {
+ try {
+ return defineClass(null,
+ byteArray,
+ 0,
+ byteArray.length);
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubySCAConfig.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubySCAConfig.java
new file mode 100644
index 0000000000..ce1dfc0323
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubySCAConfig.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.rubyscript;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Scope;
+import org.jruby.RubyHash;
+import org.jruby.RubyObject;
+import org.jruby.internal.runtime.GlobalVariables;
+import org.jruby.runtime.builtin.IRubyObject;
+
+/**
+ * Represents the variable defining the SCA aspects of the script
+ * <code>
+ * SCA = {
+ * javaInterface : "my.pkg.ClassName",
+ * wsdlPortType : "wsdlPortTypeName",
+ * wsdlNameSpace : "http://my.namespace.com",
+ * wsdlLocation : "\wsdl\mywsdl.txt",
+ * properties : { "foo" : ["java.lang.String", "defaultValue"],},
+ * references : {},
+ * scope : 'stateless'|'request'|'conversational'|'composite',
+ * }
+ * </code>
+ * The config must define the service with either javaInterface or wsdl. When
+ * using wsdl the three parameters are optional. If wsdlLocation is used that is the
+ * WSDL document used, and the namespace and portType parameters are only required if
+ * the WSDL definition defines multiple portTypes.
+ */
+public class RubySCAConfig {
+
+ private boolean hasSCAConfig;
+
+ private String javaInterface;
+
+ private String wsdlLocation;
+
+ private String wsdlNamespace;
+
+ private String wsdlPortType;
+
+ private Map properties;
+
+ private Map references;
+
+ private Scope scope;
+
+ public RubySCAConfig(GlobalVariables globalVariables) {
+ IRubyObject rubyObject = globalVariables.get("$SCA");
+ if (rubyObject != null && !rubyObject.isNil()) {
+ hasSCAConfig = true;
+ RubyHash scaVar = (RubyHash) rubyObject;
+ Object o = scaVar.get("javaInterface");
+ if ( o != null ) {
+ this.javaInterface = o.toString();
+ }
+ o = scaVar.get("wsdlLocation");
+ if (o != null ) {
+ this.wsdlLocation = o.toString();
+ }
+ o = scaVar.get("wsdlPortType");
+ if (o != null ) {
+ this.wsdlPortType = o.toString();
+ }
+ o = scaVar.get("wsdlNamespace");
+ if (o != null ) {
+ this.wsdlNamespace = o.toString();
+ }
+ if (javaInterface != null) {
+ if (wsdlLocation != null || wsdlPortType != null || wsdlNamespace != null) {
+ throw new IllegalArgumentException("script SCA config defines both Java and WSDL service interface");
+ }
+ } else {
+ if (wsdlLocation == null && wsdlPortType == null && wsdlNamespace == null) {
+ throw new IllegalArgumentException("script SCA config must define either Java or WSDL service interface");
+ }
+ }
+
+ this.properties = new HashMap();
+ o = scaVar.get("properties");
+ if (o != null ) {
+ // TODO parse properties
+ }
+
+ this.references = new HashMap();
+ o = scaVar.get("references");
+ if (o != null ) {
+ // TODO parse references
+ }
+
+ o = scaVar.get("scope");
+ if (o != null ) {
+ if ("stateless".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.STATELESS;
+ } else if ("request".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.REQUEST;
+ } else if ("conversational".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.SESSION; // TODO: where's CONVERSATIONAL?
+ } else if ("composite".equalsIgnoreCase(String.valueOf(o))) {
+ this.scope = Scope.COMPOSITE; // TODO: composite = MODULE for now?
+ } else {
+ throw new IllegalArgumentException("invalid scope value: " + o);
+ }
+ }
+
+ }
+ }
+
+ public boolean hasSCAConfig() {
+ return hasSCAConfig;
+ }
+
+ public String getJavaInterface() {
+ return javaInterface;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ public Map getReferences() {
+ return references;
+ }
+
+ public String getWSDLLocation() {
+ return wsdlLocation;
+ }
+
+ public String getWSDLNamespace() {
+ return wsdlNamespace;
+ }
+
+ public String getWSDLPortType() {
+ return wsdlPortType;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScript.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScript.java
new file mode 100644
index 0000000000..87d995eabd
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScript.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.rubyscript;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import org.jruby.IRuby;
+import org.jruby.RubyString;
+import org.jruby.javasupport.JavaEmbedUtils;
+import org.jruby.javasupport.JavaUtil;
+import org.jruby.runtime.builtin.IRubyObject;
+
+/**
+ * A RhinoScript represents a compiled JavaScript script
+ */
+public class RubyScript {
+ protected final String NEW = ".new";
+ protected final String EQUAL = "=";
+
+ protected String scriptName;
+
+ protected String script;
+
+ protected Map<String, Class> responseClasses;
+
+ protected ClassLoader classLoader;
+
+ private IRuby rubyEngine = JavaEmbedUtils.initialize(new Vector());
+
+ /**
+ * Create a new RubyScript.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ */
+ public RubyScript(String scriptName, String script) {
+ this(scriptName, script, (Map) null, null);
+ }
+
+ /**
+ * Create a new RubyScript.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ * @param context
+ * name-value pairs that are added in to the scope where the script is compiled. May be null. The value objects are made available to
+ * the script by using a variable with the name.
+ * @param classLoader
+ * the ClassLoader to be used to locate any user Java classes used in the script
+ */
+ public RubyScript(String scriptName, String script, Map context, ClassLoader classLoader) {
+ this.scriptName = scriptName;
+ this.script = script;
+ this.responseClasses = new HashMap<String, Class>();
+ this.classLoader = classLoader;
+ rubyEngine.loadScript((RubyString) JavaUtil.convertJavaToRuby(rubyEngine,
+ "MyScript.rb",
+ String.class),
+ (RubyString) JavaUtil.convertJavaToRuby(rubyEngine,
+ this.script,
+ String.class),
+ false);
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ *
+ * @return a IRubyObject
+ */
+public RubyScriptInstance createScriptInstance(Map<String, Object> context, String rubyClassName) {
+ if ( rubyClassName == null ) {
+ return new RubyScriptInstance(rubyEngine.evalScript(script), responseClasses);
+ }
+ else {
+ IRubyObject rubyObject = rubyEngine.evalScript(rubyClassName + NEW);
+
+ Iterator<String> keyIterator = context.keySet().iterator();
+ String key = null;
+ Object value = null;
+ while ( keyIterator.hasNext()) {
+ key = keyIterator.next();
+ value = JavaUtil.convertJavaToRuby(rubyEngine,
+ context.get(key),
+ context.get(key).getClass());
+
+ JavaEmbedUtils.invokeMethod(rubyEngine,
+ rubyObject,
+ key + EQUAL,
+ new Object[]{value}, null);
+ }
+
+ return new RubyScriptInstance(rubyObject, responseClasses);
+ }
+ }
+ public String getScript() {
+ return script;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public Map<String, Class> getResponseClasses() {
+ return responseClasses;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ /**
+ * Set the Java type of a response value. JavaScript is dynamically typed so Rhino cannot always work out what the intended Java type of a
+ * response should be, for example should the statement "return 42" be a Java int, or Integer or Double etc. When Rhino can't determine the type
+ * it will default to returning a String, using this method enables overriding the Rhino default to use a specific Java type.
+ */
+ public void setResponseClass(String functionName, Class responseClasses) {
+ this.responseClasses.put(functionName,
+ responseClasses);
+ }
+
+ public RubySCAConfig getSCAConfig() {
+ return new RubySCAConfig(rubyEngine.getGlobalVariables());
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+ public IRuby getRubyEngine() {
+ return rubyEngine;
+ }
+
+ public void setRubyEngine(IRuby rubyEngine) {
+ this.rubyEngine = rubyEngine;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScriptInstance.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScriptInstance.java
new file mode 100644
index 0000000000..2d93c57fc9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyScriptInstance.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.rubyscript;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jruby.javasupport.JavaEmbedUtils;
+import org.jruby.runtime.builtin.IRubyObject;
+
+/**
+ * An invokeable instance of a JavaScript script.
+ */
+public class RubyScriptInstance {
+
+ private IRubyObject rubyInstance;
+
+ private Map<String, Class> responseClasses;
+
+ public RubyScriptInstance(IRubyObject rubyInstance, Map<String, Class> responseClasses) {
+ this.rubyInstance = rubyInstance;
+ this.responseClasses = responseClasses;
+ if (this.responseClasses == null) {
+ this.responseClasses = new HashMap<String, Class>();
+ }
+ }
+
+ public Object invokeFunction(String functionName, Object[] args, Class returnType) {
+ Object[] rubyArgs = RubyUtils.fromJavaToRuby(rubyInstance.getRuntime(), args);
+
+ Object rubyResponse = JavaEmbedUtils.invokeMethod(rubyInstance.getRuntime(),
+ rubyInstance,
+ functionName,
+ rubyArgs,
+ returnType);
+ Object response = RubyUtils.fromRubyToJava(rubyInstance.getRuntime(),
+ returnType,
+ rubyResponse);
+ return response;
+ }
+
+
+
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyUtils.java b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyUtils.java
new file mode 100644
index 0000000000..c19f233b94
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/java/org/apache/tuscany/container/ruby/rubyscript/RubyUtils.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.rubyscript;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.jruby.IRuby;
+import org.jruby.RubyObject;
+import org.jruby.javasupport.JavaUtil;
+
+/**
+ * @author administrator
+ *
+ */
+public class RubyUtils {
+ public static Object fromRubyToJava(IRuby rubyEngine, Class reqArgType, Object rubyArg) {
+ Object javaArg = null;
+
+ //for known cases the JRuby runtime handles the conversion before calling the Java objects
+ //so nothing to do. When it cannot convert it simply passed the instance of RubyObject
+ if ( rubyArg instanceof RubyObject ) {
+ //need to deal with this
+ } else {
+ javaArg = rubyArg;
+ }
+
+ return javaArg;
+ }
+
+ public static Object[] fromJavaToRuby(IRuby rubyEngine, Object[] arg) {
+ Object[] jsArgs;
+ if (arg == null) {
+ jsArgs = new Object[0];
+ } else {
+ jsArgs = new Object[arg.length];
+ for (int i = 0; i < jsArgs.length; i++) {
+ jsArgs[i] = fromJavaToRuby(rubyEngine, arg[i]);
+ }
+ }
+
+ return jsArgs;
+ }
+
+ public static Object fromJavaToRuby(IRuby rubyEngine, Object javaObj) {
+ Object rubyObj = JavaUtil.convertJavaToRuby(rubyEngine, javaObj, javaObj.getClass());
+ return rubyObj;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..407355daec
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Ruby configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.launcher.RubyImplementation">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.ruby</group>
+ <name>tuscany-ruby</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="ruby.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyImplementationLoader"/>
+ </component>
+
+ <component name="ruby.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyComponentTypeLoader"/>
+ </component>
+
+ <component name="ruby.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/ruby.system.scdl b/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/ruby.system.scdl
new file mode 100644
index 0000000000..7092361a3d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/main/resources/META-INF/sca/ruby.system.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Ruby configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.launcher.RubyImplementation">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.ruby</group>
+ <name>tuscany-ruby</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="ruby.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyImplementationLoader"/>
+ </component>
+
+ <component name="ruby.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyComponentTypeLoader"/>
+ </component>
+
+ <component name="ruby.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.ruby.RubyComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..7e99f6f720
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+
+public interface HelloWorldService {
+ String sayHello(String s);
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldServiceImpl.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..be804d3540
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/helloworld/HelloWorldServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Property;
+
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ @Property
+ public String greeting = "Default hello";
+
+ public String getGreeting() {
+ return greeting;
+ }
+
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String sayHello(String s) {
+ //return greeting + s + " from the JavaWorld!";
+ return greeting + " from Java Reference " + s ; //+ " from " + helloSayer.firstName + " " + helloSayer.lastName;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyImplementationLoaderTestCase.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..7fb5fb68c5
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyImplementationLoaderTestCase.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+
+/**
+ * Tests for RubyImplementationLoader
+ */
+public class RubyImplementationLoaderTestCase extends TestCase {
+ private CompositeComponent parent;
+
+ private XMLStreamReader reader;
+
+ private DeploymentContext deploymentContext;
+
+ private ClassLoader classLoader;
+
+ private LoaderRegistry registry;
+
+ private RubyImplementationLoader loader;
+
+ public void testNoScriptAttribute() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn(null);
+ expect(reader.getAttributeValue(null, "class")).andReturn(null);
+ replay(reader);
+ replay(deploymentContext);
+
+ try {
+ loader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ // ok
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testNoScriptPresent() throws LoaderException, XMLStreamException {
+ expect(reader.getAttributeValue(null, "script")).andReturn("foo.groovy");
+ expect(reader.getAttributeValue(null, "class")).andReturn(null);
+ expect(deploymentContext.getClassLoader()).andReturn(classLoader);
+
+ replay(reader);
+ replay(deploymentContext);
+
+ RubyImplementationLoader mockLoader = new RubyImplementationLoader(registry) {
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ assertSame(classLoader, cl);
+ assertEquals("foo.groovy", resource);
+ throw new MissingResourceException(resource);
+ }
+ };
+ try {
+ mockLoader.load(parent, null, reader, deploymentContext);
+ fail();
+ } catch (MissingResourceException e) {
+ assertEquals("foo.groovy", e.getIdentifier());
+ }
+ verify(reader);
+ verify(deploymentContext);
+ }
+
+ public void testLoadScript() throws LoaderException {
+ String script =
+ loader.loadSource(getClass().getClassLoader(), "org/apache/tuscany/container/ruby/mock/test.rb");
+ assertEquals("//Test Script", script);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ loader = new RubyImplementationLoader(registry);
+
+ parent = createMock(CompositeComponent.class);
+ reader = createMock(XMLStreamReader.class);
+ deploymentContext = createMock(DeploymentContext.class);
+ classLoader = createMock(ClassLoader.class);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyScriptIntrospectorTestCase.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyScriptIntrospectorTestCase.java
new file mode 100644
index 0000000000..66a1fb6e30
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/RubyScriptIntrospectorTestCase.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubySCAConfig;
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+public class RubyScriptIntrospectorTestCase extends TestCase {
+
+ private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() {
+ public void readingWSDL(String namespace, URL location) {
+ }
+
+ public void cachingDefinition(String namespace, URL location) {
+ }
+ };
+
+ public void testJavaInterface() throws MissingResourceException,
+ InvalidServiceContractException {
+ RubyScript rs = new RubyScript("javaInterfaceTest",
+ "$SCA = { 'javaInterface' => 'helloworld.HelloWorldService'}",
+ null,
+ getClass().getClassLoader());
+ RubySCAConfig scaConfig = new RubySCAConfig(rs.getRubyEngine().getGlobalVariables());
+ RubyIntrospector introspector = new RubyIntrospector(null,
+ new JavaInterfaceProcessorRegistryImpl());
+ ComponentType comonentType = introspector.introspectScript(scaConfig,
+ rs.getClassLoader());
+ assertNotNull(comonentType);
+ Map services = comonentType.getServices();
+ assertEquals(1,
+ services.size());
+ ServiceDefinition serviceDefinition = (ServiceDefinition) services.values()
+ .iterator()
+ .next();
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ assertTrue(serviceContract instanceof JavaServiceContract);
+ JavaServiceContract javaServiceContract = (JavaServiceContract) serviceContract;
+ assertEquals(HelloWorldService.class,
+ javaServiceContract.getInterfaceClass());
+ }
+
+ public void testWSDLLocation() throws WSDLException {
+ // RhinoScript rs = new RhinoScript("wsdlLocation",
+ // "SCA = { wsdlLocation : 'src/test/resources/org/apache/tuscany/container/javascript/rhino/helloworld.wsdl',};", null, getClass()
+ // .getClassLoader());
+ // RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());
+ // JavaScriptIntrospector introspector = new JavaScriptIntrospector(null);
+ // ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
+ // assertNotNull(comonentType);
+ // Map serviceBindings = comonentType.getServices();
+ // assertEquals(1, serviceBindings.size());
+ // ServiceDefinition serviceDefinition = (ServiceDefinition) serviceBindings.values().iterator().next();
+ // ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ // assertTrue(serviceContract instanceof WSDLServiceContract);
+ // WSDLServiceContract wsdlServiceContract = (WSDLServiceContract) serviceContract;
+ // assertEquals(new QName("http://helloworld", "HelloWorld"), wsdlServiceContract.getPortType().getQName());
+ }
+
+ public void testWSDLPortType() throws WSDLException,
+ IOException,
+ MissingResourceException,
+ InvalidServiceContractException {
+ RubyScript rs = new RubyScript("wsdlPortType",
+ "$SCA = { 'wsdlPortType' => 'HelloWorld', 'wsdlNamespace' => 'http://helloworld'}",
+ null,
+ getClass().getClassLoader());
+ RubySCAConfig scaConfig = new RubySCAConfig(rs.getRubyEngine().getGlobalVariables());
+
+ WSDLDefinitionRegistryImpl wsdlReg = new WSDLDefinitionRegistryImpl();
+ wsdlReg.setMonitor(NULL_MONITOR);
+ URL wsdlURL = getClass().getClassLoader()
+ .getResource("org/apache/tuscany/container/ruby/jruby/helloworld.wsdl");
+ wsdlReg.loadDefinition("http://helloworld",
+ wsdlURL);
+
+ RubyIntrospector introspector = new RubyIntrospector(wsdlReg,
+ new JavaInterfaceProcessorRegistryImpl());
+ ComponentType comonentType = introspector.introspectScript(scaConfig,
+ rs.getClassLoader());
+ assertNotNull(comonentType);
+ Map services = comonentType.getServices();
+ assertEquals(1,
+ services.size());
+ ServiceDefinition serviceDefinition = (ServiceDefinition) services.values()
+ .iterator()
+ .next();
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ assertTrue(serviceContract instanceof WSDLServiceContract);
+ WSDLServiceContract wsdlServiceContract = (WSDLServiceContract) serviceContract;
+ assertEquals(new QName("http://helloworld", "HelloWorld"),
+ wsdlServiceContract.getPortType().getQName());
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/ScriptInvokeTestCase.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/ScriptInvokeTestCase.java
new file mode 100644
index 0000000000..f119c3564b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/ScriptInvokeTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+
+/**
+ * Tests for invoker JavaScriptComponents
+ */
+public class ScriptInvokeTestCase extends TestCase {
+
+ private static final String SCRIPT = "def greet(name) \n return name \n end \n";
+
+ private RubyScript rubyScript;
+
+ /**
+ * Tests the invocation of a Groovy "script" as opposed to a class
+ */
+ public void testBasicScriptInvocation() throws Exception {
+// ModuleScopeContainer scope = new ModuleScopeContainer(null);
+// scope.start();
+// List<Class<?>> serviceBindings = new ArrayList<Class<?>>();
+// serviceBindings.add(Greeting.class);
+// RubyComponent<Greeting> context = new RubyComponent<Greeting>("source", rhinoScript, serviceBindings, new HashMap<String, Object>(),
+// null, scope, ArtifactFactory.createWireService(), null);
+// scope.register(context);
+// Greeting object = (Greeting) context.getServiceInstance();
+// assertEquals("foo", object.greet("foo"));
+// scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ rubyScript = new RubyScript("test", SCRIPT);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/WireTestCase.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/WireTestCase.java
new file mode 100644
index 0000000000..81726763db
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/WireTestCase.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.ruby.mock.Greeting;
+import org.apache.tuscany.container.ruby.rubyscript.RubyScript;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.test.ArtifactFactory;
+import static org.easymock.EasyMock.reportMatcher;
+import org.easymock.IArgumentMatcher;
+
+/**
+ * Tests for JavaScript component wiring
+ */
+public class WireTestCase extends TestCase {
+
+ private static final String SCRIPT = " def setWire(ref)\n" + " wire = ref\n"
+ + "end \n" + " def greet(name)\n" + " return wire.greet(name) \n"
+ + " end\n";
+
+ private static final String SCRIPT2 = " def greet(name)\n" + " return name \n"
+ + "end \n";
+
+ private RubyScript implClass1;
+
+ private RubyScript implClass2;
+ private WireService wireSerivce;
+
+ /**
+ * Tests a basic invocation down a source wire
+ */
+ public void testReferenceWireInvocation() throws Exception {
+ // ModuleScopeContainer scope = new ModuleScopeContainer(null);
+ // scope.start();
+ //
+ // List<Class<?>> serviceBindings = new ArrayList<Class<?>>();
+ // serviceBindings.add(Greeting.class);
+ // JavaScriptComponent<Greeting> context = new JavaScriptComponent<Greeting>("source", implClass1, serviceBindings, properties, null, scope,
+ // ArtifactFactory.createWireService(), null);
+ // OutboundWire<?> wire = ArtifactFactory.createOutboundWire("wire", Greeting.class);
+ // ArtifactFactory.terminateWire(wire);
+ //
+ // TargetInvoker invoker = createMock(TargetInvoker.class);
+ // expect(invoker.isCacheable()).andReturn(false);
+ // Message response = new MessageImpl();
+ // response.setBody("foo");
+ // expect(invoker.invoke(eqMessage())).andReturn(response);
+ // replay(invoker);
+ //
+ // for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
+ // chain.setTargetInvoker(invoker);
+ // }
+ // scope.register(context);
+ // context.addOutboundWire(wire);
+ // Greeting greeting = context.getServiceInstance();
+ // assertEquals("foo", greeting.greet("foo"));
+ // verify(invoker);
+ //
+ // scope.stop();
+ }
+
+ // todo this could be generalized and moved to test module
+ public static Message eqMessage() {
+ reportMatcher(new IArgumentMatcher() {
+ public boolean matches(Object object) {
+ if (!(object instanceof Message)) {
+ return false;
+ }
+ final Message msg = (Message) object;
+ Object[] body = (Object[]) msg.getBody();
+ return "foo".equals(body[0]);
+ }
+
+ public void appendTo(StringBuffer stringBuffer) {
+ }
+ });
+ return null;
+ }
+
+ /**
+ * Tests a basic invocation to a target
+ */
+ public void testTargetInvocation() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ Map<String, Object> properties = new Hashtable<String, Object>();
+ properties.put("greeting", "HeyThere");
+
+ RubyComponent context = new RubyComponent("source",
+ implClass2,
+ null,
+ properties,
+ null,
+ ArtifactFactory.createWireService(),
+ null,
+ null);
+ scope.register(context);
+ DataType<String> returnDataType = new DataType<String>(String.class, String.class.getName());
+// Operation<String> operation = new Operation<String>("greet",
+// returnDataType,
+// null,
+// null,
+// false,
+// null);
+//
+// TargetInvoker invoker = context.createTargetInvoker(null,
+// operation);
+// assertEquals("foo",
+// invoker.invokeTarget(new String[]{"foo"}));
+ scope.stop();
+ }
+
+ /**
+ * Tests a basic invocation down a target wire
+ */
+ public void testTargetWireInvocation() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Greeting.class);
+ Map<String, Object> properties = new Hashtable<String, Object>();
+ properties.put("greeting", "HeyThere");
+ RubyComponent context = new RubyComponent("source",
+ implClass2,
+ null,
+ properties,
+ null,
+ ArtifactFactory.createWireService(),
+ null,
+ null);
+ context.setScopeContainer(scope);
+ scope.register(context);
+
+ InboundWire wire = ArtifactFactory.createLocalInboundWire("Greeting",
+ Greeting.class);
+ ArtifactFactory.terminateWire(wire);
+ for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(context.createTargetInvoker(null,
+ chain.getOperation(), null));
+ }
+ context.addInboundWire(wire);
+ Greeting greeting = wireSerivce.createProxy(Greeting.class, context.getInboundWire("Greeting"));
+ assertEquals("foo",
+ greeting.greet("foo"));
+ scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireSerivce = ArtifactFactory.createWireService();
+ implClass1 = new RubyScript("script1", SCRIPT);
+ implClass2 = new RubyScript("script2", SCRIPT2);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/function/HelloWorldTestCase.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/function/HelloWorldTestCase.java
new file mode 100644
index 0000000000..c2af5b9b10
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/function/HelloWorldTestCase.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.function;
+
+import java.net.URL;
+
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class HelloWorldTestCase extends SCATestCase {
+
+ private HelloWorldService helloWorldService;
+ private CompositeContext context = null;
+
+
+ protected void setUp() throws Exception {
+ URL base = getClass().getResource("/META-INF/sca/ruby.system.scdl");
+ addExtension("RubyContainer", new URL(base, "default.scdl"));
+ setApplicationSCDL(getClass().getResource("helloworld.scdl"));
+ super.setUp();
+
+ context = CurrentCompositeContext.getContext();
+ helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldRubyComponent");
+
+ //helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldJavaReference");
+ }
+
+ public void testHelloWorldWithClass() throws Exception {
+ assertEquals(helloWorldService.sayHello("petra"), "Hey Howdy from Java Reference petra");
+ //System.out.println(helloWorldService.sayHello("petra"));
+ }
+
+ public void testHelloWorldGlobal() throws Exception {
+ assertEquals(helloWorldService.sayHello("artep"), "Hey Howdy from Java Reference artep");
+ //System.out.println(helloWorldService.sayHello("artep"));
+ }
+
+ public void testHelloWorldProperty() throws Exception {
+ HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldProperty");
+ assertEquals(helloWorldService.sayHello("petra"), "Namaskaar petra");
+ //System.out.println(helloWorldService.sayHello("petra"));
+ }
+
+ public void testHelloWorldPropertyDefault() throws Exception {
+ HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldPropertyDefault");
+ assertEquals(helloWorldService.sayHello("petra"), "Bow Wow petra");
+ //System.out.println(helloWorldService.sayHello("petra"));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/mock/Greeting.java b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/mock/Greeting.java
new file mode 100644
index 0000000000..acf71f152b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/java/org/apache/tuscany/container/ruby/mock/Greeting.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.ruby.mock;
+
+public interface Greeting {
+
+ String setWire(Greeting ref);
+
+ String greet(String name);
+}
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.componentType b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.componentType
new file mode 100644
index 0000000000..9ca226b429
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+ <reference name="extHelloWorld">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </reference>
+ <property name="greeting" type="xsd:string">Hullow</property>
+</componentType>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.rb b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.rb
new file mode 100644
index 0000000000..3f1a053b15
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/HelloWorld.rb
@@ -0,0 +1,33 @@
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+
+class Helloworld
+
+ def sayHello(s)
+ return "Hello to " + s + " from the Ruby World!"
+ end
+
+end
+
+class HelloWorldServiceRubyImpl
+ attr_writer :extHelloWorld
+ attr_writer :greeting
+
+ def sayHello(s)
+ return @greeting + " " + @extHelloWorld.sayHello(s);
+ end
+end
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/IntrospectableHelloWorld.rb b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/IntrospectableHelloWorld.rb
new file mode 100644
index 0000000000..d4edb7a100
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/IntrospectableHelloWorld.rb
@@ -0,0 +1,30 @@
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+
+$SCA = {
+ 'javaInterface' => 'helloworld.HelloWorldService'
+}
+
+def sayHello(s)
+ return "Hello to " + s + " from the Ruby World!"
+end
+
+class HelloWorldServiceRubyImpl
+ def sayHello(s)
+ return "Hello to " + s + " from the Ruby World!"
+ end
+end
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/helloworld.scdl b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/helloworld.scdl
new file mode 100644
index 0000000000..9aeb652afa
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/helloworld.scdl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:rb="http://tuscany.apache.org/xmlns/rb/1.0"
+
+ name="HelloWorldComposite">
+
+ <component name="HelloWorldRubyComponent">
+ <rb:implementation.rb script="org/apache/tuscany/container/ruby/function/HelloWorld.rb" class="HelloWorldServiceRubyImpl"/>
+ <reference name="extHelloWorld" target="HelloWorldJavaReference">HelloWorldJavaReference</reference>
+ <property name="greeting">Hey</property>
+ </component>
+
+ <component name="HelloWorldJavaReference">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <property name="greeting">Howdy</property>
+ </component>
+
+ <component name="HelloWorldProperty">
+ <rb:implementation.rb script="org/apache/tuscany/container/ruby/function/propertyTest.rb" class="HelloWorldPropertyTest"/>
+ <property name="GREETING">Namaskaar</property>
+ </component>
+
+ <component name="HelloWorldPropertyDefault">
+ <rb:implementation.rb script="org/apache/tuscany/container/ruby/function/propertyTest.rb" class="HelloWorldPropertyTest"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.componentType b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.componentType
new file mode 100644
index 0000000000..6704e285f1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.componentType
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+ <property name="GREETING" type="xsd:string">Bow Wow</property>
+</componentType>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.rb b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.rb
new file mode 100644
index 0000000000..7aa0f3e8ea
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/function/propertyTest.rb
@@ -0,0 +1,24 @@
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+
+class HelloWorldPropertyTest
+ attr_writer :GREETING
+
+ def sayHello(s)
+ return @GREETING + " " + s;
+ end
+end \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/jruby/helloworld.wsdl b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/jruby/helloworld.wsdl
new file mode 100644
index 0000000000..67067f044a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/jruby/helloworld.wsdl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/mock/test.rb b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/mock/test.rb
new file mode 100644
index 0000000000..ef2694b475
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/container/src/test/resources/org/apache/tuscany/container/ruby/mock/test.rb
@@ -0,0 +1 @@
+//Test Script \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-ruby/pom.xml.off b/sandbox/old/contrib/implementation-ruby/pom.xml.off
new file mode 100644
index 0000000000..35ae29d101
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/pom.xml.off
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.ruby</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Ruby Extension</name>
+
+ <modules>
+ <module>container</module>
+ <module>samples</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/README.txt b/sandbox/old/contrib/implementation-ruby/samples/helloworld/README.txt
new file mode 100644
index 0000000000..7ae86d6222
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/README.txt
@@ -0,0 +1,34 @@
+Helloworld Ruby Sample
+======================
+
+This sample illustrates the use of an extension to support other implementation types.
+In this sample the component is implemented using a script written in the Ruby language.
+
+Building
+--------
+
+To build and install the sample using Maven use:
+$ mvn install
+
+This will build the sample, package a JAR file for the composite and install it in your
+local maven repository for use by other samples.
+
+Running
+-------
+
+To unpack the distribution to run the sample use:
+$ mvn dependency:unpack
+
+The 1.0-incubator-M2 distribution will be unpacked to the target/distribution directory.
+
+To configure the extension, copy its jar file into the extensions directory.
+$ cp target/distribution/contrib/ruby-1.0-incubator-M2.jar target/distribution/extensions/.
+
+You can then run the sample using the launcher:
+$ java -jar target/distribution/bin/launcher.jar target/sample-helloworld-ruby.jar
+
+Modifying
+---------
+
+The source code for the sample is in the src/main/java directory.
+The XML for the SCA composite is in src/main/resouces/META-INF/sca/default.scdl \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-ruby/samples/helloworld/pom.xml.off
new file mode 100644
index 0000000000..ed02813036
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/pom.xml.off
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.ruby.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworld-ruby</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Ruby helloworld Sample</name>
+ <description>A helloworld sample using a single SCA Ruby component</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.ruby</groupId>
+ <artifactId>tuscany-ruby</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..719a967230
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * Client program to invoke the HelloWorld Ruby component
+ */
+public class HelloWorldClient {
+ public static void main(String[] args) throws Exception {
+
+ HelloWorldService helloWorldService =
+ CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "HelloWorldComponent");
+
+ System.out.println(helloWorldService.sayHello(args.length < 1 ? "world" : args[0]));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..fd126a197a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+public interface HelloWorldService {
+
+ String sayHello(String s);
+
+}
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..b52739449d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="helloworld.HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+
+</componentType>
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.rb b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.rb
new file mode 100644
index 0000000000..d9e54620f0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/HelloWorld.rb
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class Helloworld
+
+ def sayHello(s)
+ return "Hello to " + s + " from the Ruby World!"
+ end
+
+end
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/LICENSE.txt b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..3865da3116
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,1277 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE TUSCANY SUBCOMPONENTS:
+
+The Apache Tuscany distribution includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+For the Eclipse Modeling Framework component and the Celtix binding:
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript container component:
+
+Mozilla Public License 1.1 (MPL 1.1)
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original Code,
+prior Modifications used by a Contributor, and the Modifications made by that
+particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+combination of the Original Code and Modifications, in each case including
+portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+accepted in the software development community for the electronic transfer of
+data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified as
+the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+extent possible, whether at the time of the initial grant or subsequently
+acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+substance or structure of either the Original Code or any previous
+Modifications. When Covered Code is released as a series of files, a
+Modification is:
+ A. Any addition to or deletion from the contents of a file
+containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+which is described in the Source Code notice required by Exhibit A as Original
+Code, and which, at the time of its release under this License is not already
+Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+hereafter acquired, including without limitation, method, process, and
+apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+making modifications to it, including all modules it contains, plus any
+associated interface definition files, scripts used to control compilation and
+installation of an Executable, or source code differential comparisons against
+either the Original Code or another well known, available Covered Code of the
+Contributor's choice. The Source Code can be in a compressed or archival form,
+provided the appropriate decompression or de-archiving software is widely
+available for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+exercising rights under, and complying with all of the terms of, this License
+or a future version of this License issued under Section 6.1. For legal
+entities, "You" includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this definition, "control"
+means (a) the power, direct or indirect, to cause the direction or management
+of such entity, whether by contract or otherwise, or (b) ownership of more
+than fifty percent (50%) of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property claims:
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Initial Developer to use, reproduce, modify, display,
+perform, sublicense and distribute the Original Code (or portions thereof)
+with or without Modifications, and/or as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or selling
+of Original Code, to make, have made, use, practice, sell, and offer for sale,
+and/or otherwise dispose of the Original Code (or portions thereof).
+ (c) the licenses granted in this Section 2.1(a) and
+(b) are effective on the date Initial Developer first distributes Original
+Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+granted: 1) for code that You delete from the Original Code; 2) separate from
+the Original Code; or 3) for infringements caused by: i) the modification of
+the Original Code or ii) the combination of the Original Code with other
+software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Contributor, to use, reproduce, modify, display,
+perform, sublicense and distribute the Modifications created by such
+Contributor (or portions thereof) either on an unmodified basis, with other
+Modifications, as Covered Code and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+of Modifications made by that Contributor either alone and/or in combination
+with its Contributor Version (or portions of such combination), to make, use,
+sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications
+made by that Contributor (or portions thereof); and 2) the combination of
+Modifications made by that Contributor with its Contributor Version (or
+portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+effective on the date Contributor first makes Commercial Use of the Covered
+Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+granted: 1) for any code that Contributor has deleted from the Contributor
+Version; 2) separate from the Contributor Version; 3) for infringements
+caused by: i) third party modifications of Contributor Version or ii) the
+combination of Modifications made by that Contributor with other software
+(except as part of the Contributor Version) or other devices; or 4) under
+Patent Claims infringed by Covered Code in the absence of Modifications made
+by that Contributor.
+
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+governed by the terms of this License, including without limitation Section
+2.2. The Source Code version of Covered Code may be distributed only under the
+terms of this License or a future version of this License released under
+Section 6.1, and You must include a copy of this License with every copy of
+the Source Code You distribute. You may not offer or impose any terms on any
+Source Code version that alters or restricts the applicable version of this
+License or the recipients' rights hereunder. However, You may include an
+additional document offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+made available in Source Code form under the terms of this License either on
+the same media as an Executable version or via an accepted Electronic
+Distribution Mechanism to anyone to whom you made an Executable version
+available; and if made available via Electronic Distribution Mechanism, must
+remain available for at least twelve (12) months after the date it initially
+became available, or at least six (6) months after a subsequent version of
+that particular Modification has been made available to such recipients. You
+are responsible for ensuring that the Source Code version remains available
+even if the Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+file documenting the changes You made to create that Covered Code and the date
+of any change. You must include a prominent statement that the Modification is
+derived, directly or indirectly, from Original Code provided by the Initial
+Developer and including the name of the Initial Developer in (a) the Source
+Code, and (b) in any notice in an Executable version or related documentation
+in which You describe the origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+intellectual property rights is required to exercise the rights granted by
+such Contributor under Sections 2.1 or 2.2, Contributor must include a text
+file with the Source Code distribution titled "LEGAL" which describes the
+claim and the party making the claim in sufficient detail that a recipient
+will know whom to contact. If Contributor obtains such knowledge after the
+Modification is made available as described in Section 3.2, Contributor shall
+promptly modify the LEGAL file in all copies Contributor makes available
+thereafter and shall take other steps (such as notifying appropriate mailing
+lists or newsgroups) reasonably calculated to inform those who received the
+Covered Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+interface and Contributor has knowledge of patent licenses which are
+reasonably necessary to implement that API, Contributor must also include this
+information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+Section 3.4(a) above, Contributor believes that Contributor's Modifications
+are Contributor's original creation(s) and/or Contributor has sufficient
+rights to grant the rights conveyed by this License.
+
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+Code. If it is not possible to put such notice in a particular Source Code
+file due to its structure, then You must include such notice in a location
+(such as a relevant directory) where a user would be likely to look for such a
+notice. If You created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also duplicate
+this License in any documentation for the Source Code where You describe
+recipients' rights or ownership rights relating to Covered Code. You may
+choose to offer, and to charge a fee for, warranty, support, indemnity or
+liability obligations to one or more recipients of Covered Code. However, You
+may do so only on Your own behalf, and not on behalf of the Initial Developer
+or any Contributor. You must make it absolutely clear than any such warranty,
+support, indemnity or liability obligation is offered by You alone, and You
+hereby agree to indemnify the Initial Developer and every Contributor for any
+liability incurred by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+requirements of Section 3.1-3.5 have been met for that Covered Code, and if
+You include a notice stating that the Source Code version of the Covered Code
+is available under the terms of this License, including a description of how
+and where You have fulfilled the obligations of Section 3.2. The notice must
+be conspicuously included in any notice in an Executable version, related
+documentation or collateral in which You describe recipients' rights relating
+to the Covered Code. You may distribute the Executable version of Covered Code
+or ownership rights under a license of Your choice, which may contain terms
+different from this License, provided that You are in compliance with the
+terms of this License and that the license for the Executable version does not
+attempt to limit or alter the recipient's rights in the Source Code version
+from the rights set forth in this License. If You distribute the Executable
+version under a different license You must make it absolutely clear that any
+terms which differ from this License are offered by You alone, not by the
+Initial Developer or any Contributor. You hereby agree to indemnify the
+Initial Developer and every Contributor for any liability incurred by the
+Initial Developer or such Contributor as a result of any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+not governed by the terms of this License and distribute the Larger Work as a
+single product. In such a case, You must make sure the requirements of this
+License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Code due to statute,
+judicial order, or regulation then You must: (a) comply with the terms of this
+License to the maximum extent possible; and (b) describe the limitations and
+the code they affect. Such description must be included in the LEGAL file
+described in Section 3.4 and must be included with all distributions of the
+Source Code. Except to the extent prohibited by statute or regulation, such
+description must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has attached
+the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+and/or new versions of the License from time to time. Each version will be
+given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+License, You may always continue to use it under the terms of that version.
+You may also choose to use such Covered Code under the terms of any subsequent
+version of the License published by Netscape. No one other than Netscape has
+the right to modify the terms applicable to Covered Code created under this
+License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+only do in order to apply it to code which is not already Covered Code
+governed by this License), You must (a) rename Your license so that the
+phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or
+any confusingly similar phrase do not appear in your license (except to note
+that your license differs from this License) and (b) otherwise make it clear
+that Your version of the license contains terms which differ from the Mozilla
+Public License and Netscape Public License. (Filling in the name of the
+Initial Developer, Original Code or Contributor in the notice described in
+Exhibit A shall not of themselves be deemed to be modifications of this
+License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+automatically if You fail to comply with terms herein and fail to cure such
+breach within 30 days of becoming aware of the breach. All sublicenses to the
+Covered Code which are properly granted shall survive any termination of this
+License. Provisions which, by their nature, must remain in effect beyond the
+termination of this License shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+claim (excluding declatory judgment actions) against Initial Developer or a
+Contributor (the Initial Developer or Contributor against whom You file such
+action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+infringes any patent, then any and all rights granted by such Participant to
+You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+from Participant terminate prospectively, unless if within 60 days after
+receipt of notice You either: (i) agree in writing to pay Participant a
+mutually agreeable reasonable royalty for Your past and future use of
+Modifications made by such Participant, or (ii) withdraw Your litigation claim
+with respect to the Contributor Version against such Participant. If within
+60 days of notice, a reasonable royalty and payment arrangement are not
+mutually agreed upon in writing by the parties or the litigation claim is not
+withdrawn, the rights granted by Participant to You under Sections 2.1 and/or
+2.2 automatically terminate at the expiration of the 60 day notice period
+specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+Contributor Version, directly or indirectly infringes any patent, then any
+rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are
+revoked effective as of the date You first made, used, sold, distributed, or
+had made, Modifications made by that Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+alleging that such Participant's Contributor Version directly or indirectly
+infringes any patent where such claim is resolved (such as by license or
+settlement) prior to the initiation of patent infringement litigation, then
+the reasonable value of the licenses granted by such Participant under
+Sections 2.1 or 2.2 shall be taken into account in determining the amount or
+value of any payment or license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above, all
+end user license agreements (excluding distributors and resellers) which have
+been validly granted by You or any distributor hereunder prior to termination
+shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY
+SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
+WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
+EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
+DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
+OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
+EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in 48
+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and
+"commercial computer software documentation," as such terms are used in 48
+C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject matter
+hereof. If any provision of this License is held to be unenforceable, such
+provision shall be reformed only to the extent necessary to make it
+enforceable. This License shall be governed by California law provisions
+(except to the extent applicable law, if any, provides otherwise), excluding
+its conflict-of-law provisions. With respect to disputes in which at least one
+party is a citizen of, or an entity chartered or registered to do business in
+the United States of America, any litigation relating to this License shall be
+subject to the jurisdiction of the Federal Courts of the Northern District of
+California, with venue lying in Santa Clara County, California, with the
+losing party responsible for costs, including without limitation, court costs
+and reasonable attorneys' fees and expenses. The application of the United
+Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly, out of its
+utilization of rights under this License and You agree to work with Initial
+Developer and Contributors to distribute such responsibility on an equitable
+basis. Nothing herein is intended or shall be deemed to constitute any
+admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits
+you to utilize portions of the Covered Code under Your choice of the MPL or
+the alternative licenses, if any, specified by the Initial Developer in the
+file described in Exhibit A.
+
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+language governing rights and
+ limitations under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+Portions created by
+ ______________________ are Copyright (C) ______
+_______________________. All Rights
+ Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms of
+the _____ license (the [___] License), in which case the provisions of
+[______] License are applicable instead of those above. If you wish to allow
+use of your version of this file only under the terms of the [____] License
+and not to allow others to use your version of this file under the MPL,
+indicate your decision by deleting the provisions above and replace them
+with the notice and other provisions required by the [___] License. If you do
+not delete the provisions above, a recipient may use your version of this file
+under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+the notices in the Source Code files of the Original Code. You should use the
+text of this Exhibit A rather than the text found in the Original Code Source
+Code for Your Modifications.]
+
+
+===============================================================================
+
+For the JAX-WS Reference Implementation component:
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/NOTICE b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..3fd1599f79
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,15 @@
+=========================================================================
+== 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 JRuby project (http://jruby.codehaus.org/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..4eb0655898
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:rb="http://tuscany.apache.org/xmlns/rb/1.0"
+ name="HelloWorldComposite">
+
+ <component name="HelloWorldComponent">
+ <rb:implementation.rb script="HelloWorld.rb" class="Helloworld"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..65d36d714b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.net.URL;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class HelloWorldTestCase extends SCATestCase {
+
+ private HelloWorldService helloWorldService;
+
+ protected void setUp() throws Exception {
+ URL scdl = getClass().getClassLoader().getResource("META-INF/sca/ruby.system.scdl");
+ addExtension("RubyContainer", scdl);
+ setApplicationSCDL(HelloWorldService.class, "META-INF/sca/default.scdl");
+ super.setUp();
+
+ CompositeContext context = CurrentCompositeContext.getContext();
+ helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
+ }
+
+ public void testHelloWorld() throws Exception {
+ assertEquals("Hello to petra from the Ruby World!", helloWorldService.sayHello("petra"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-ruby/samples/pom.xml.off b/sandbox/old/contrib/implementation-ruby/samples/pom.xml.off
new file mode 100644
index 0000000000..48dc42919e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-ruby/samples/pom.xml.off
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.ruby</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.ruby.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the Ruby extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${specVersion}</artifactId>
+ <version>${scaVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/LICENSE.txt b/sandbox/old/contrib/implementation-script/container.jsr223/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/implementation-script/container.jsr223/NOTICE.txt b/sandbox/old/contrib/implementation-script/container.jsr223/NOTICE.txt
new file mode 100644
index 0000000000..ecc68a9614
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/container.jsr223/pom.xml.off b/sandbox/old/contrib/implementation-script/container.jsr223/pom.xml.off
new file mode 100644
index 0000000000..f2ed60361b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/pom.xml.off
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.script</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>container-jsr223</artifactId>
+ <name>Apache Tuscany Script Container using JSR-223</name>
+ <description>Apache Tuscany Script Container using JSR-223</description>
+
+ <repositories>
+ <!-- This is reqquired for Jython as 2.2 Beta1 hasn't made it to the maven repos yet -->
+ <repository>
+ <id>ant</id>
+ <url>http://people.apache.org/~antelder/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-all</artifactId>
+ <version>3.0-beta1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+
+<!-- TODO: big hack to add script engine dependencies till extension dependencies fixed -->
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R5</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>0.9.8</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>jython</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.2b1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/InstanceWrapperBase.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/InstanceWrapperBase.java
new file mode 100644
index 0000000000..730512ca58
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/InstanceWrapperBase.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetInitializationException;
+
+/**
+ * TODO: this should be in the SPI
+ */
+public class InstanceWrapperBase<T> implements InstanceWrapper<T> {
+ 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/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponent.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponent.java
new file mode 100644
index 0000000000..874e978e77
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponent.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extension.script;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+
+public class ScriptComponent extends AtomicComponentExtension {
+
+ private ScriptImplementation impl;
+ protected Map<String, List<Wire>> wires = new HashMap<String, List<Wire>>();
+
+ protected ScriptComponent(URI name,
+ ScriptImplementation implementation,
+ ProxyService proxyService,
+ WorkContext workContext,
+ URI groupId,
+ int initLevel) {
+ super(name, proxyService, workContext, groupId, initLevel);
+ impl = implementation;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
+ return new ScriptInvoker(operation.getName(), this, scopeContainer, workContext);
+ }
+
+ @SuppressWarnings("unchecked")
+ public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ try {
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // TODO: classloader?
+
+ ScriptEngineManager manager = new ScriptEngineManager();
+ ScriptEngine engine = manager.getEngineByExtension(impl.getScriptLanguage());
+ if (engine == null) {
+ throw new ObjectCreationException("no script engine found for language: " + impl.getScriptLanguage());
+ }
+
+ Reader reader;
+ if (impl.getInlineSrc() == null) {
+ URL url = impl.getClassLoader().getResource(impl.getScriptName());
+ reader = new InputStreamReader(url.openStream());
+ } else {
+ reader = new StringReader(impl.getInlineSrc());
+ }
+
+ engine.eval(reader);
+
+ return new InstanceWrapperBase(engine);
+
+ } catch (ScriptException e) {
+ throw new ObjectCreationException(e);
+ } catch (IOException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ // TODO: move all the rest to SPI extension
+
+ @Deprecated
+ public Object createInstance() throws ObjectCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAssociatedTargetInstance() throws TargetResolutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void attachWire(Wire wire) {
+ assert wire.getSourceUri().getFragment() != null;
+ String referenceName = wire.getSourceUri().getFragment();
+ List<Wire> wireList = wires.get(referenceName);
+ if (wireList == null) {
+ wireList = new ArrayList<Wire>();
+ wires.put(referenceName, wireList);
+ }
+ wireList.add(wire);
+// Member member = referenceSites.get(referenceName);
+// if (member != null) {
+// injectors.add(createInjector(member, wire));
+// }
+// // cycle through constructor param names as well
+// for (int i = 0; i < constructorParamNames.size(); i++) {
+// if (referenceName.equals(constructorParamNames.get(i))) {
+// ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
+// initializerFactories[i] = createWireFactory(constructorParamTypes.get(i), wire);
+// break;
+// }
+// }
+// //TODO error if ref not set on constructor or ref site
+
+ }
+
+
+ public void attachWires(List<Wire> attachWires) {
+ assert attachWires.size() > 0;
+ assert attachWires.get(0).getSourceUri().getFragment() != null;
+ String referenceName = attachWires.get(0).getSourceUri().getFragment();
+ List<Wire> wireList = wires.get(referenceName);
+ if (wireList == null) {
+ wireList = new ArrayList<Wire>();
+ wires.put(referenceName, wireList);
+ }
+ wireList.addAll(attachWires);
+// Member member = referenceSites.get(referenceName);
+// if (member == null) {
+// if (constructorParamNames.contains(referenceName)) {
+// // injected on the constructor
+// throw new UnsupportedOperationException();
+// } else {
+// throw new NoAccessorException(referenceName);
+// }
+// }
+//
+// Class<?> type = attachWires.get(0).getSourceContract().getInterfaceClass();
+// if (type == null) {
+// throw new NoMultiplicityTypeException("Java interface must be specified for multiplicity", referenceName);
+// }
+// injectors.add(createMultiplicityInjector(member, type, wireList));
+
+ }
+
+ public List<Wire> getWires(String name) {
+ return wires.get(name);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {
+ return new WireObjectFactory<B>(interfaze, wire, proxyService);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentBuilder.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentBuilder.java
new file mode 100644
index 0000000000..508cd7bc37
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentBuilder.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extension.script;
+
+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.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+
+public class ScriptComponentBuilder extends ComponentBuilderExtension<ScriptImplementation> {
+
+ public ScriptComponentBuilder() {
+ }
+
+ @Override
+ protected Class<ScriptImplementation> getImplementationType() {
+ return ScriptImplementation.class;
+ }
+
+ public Component build(ComponentDefinition componentDefinition, DeploymentContext context) throws BuilderException {
+
+ // setup reference injection sites
+ ComponentType componentType = componentDefinition.getImplementation().getComponentType();
+
+ for (Object o : componentType.getReferences().values()) {
+ ReferenceDefinition reference = (ReferenceDefinition) o;
+ System.out.println(reference);
+ }
+
+ URI name = componentDefinition.getUri();
+ ScriptImplementation impl = (ScriptImplementation)componentDefinition.getImplementation();
+ URI groupId = context.getComponentId();
+
+ Component scriptComponent = new ScriptComponent(name, impl, proxyService, workContext, groupId, 0);
+ return scriptComponent;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentType.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentType.java
new file mode 100644
index 0000000000..bd01317873
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentType.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * A componentType for script components
+ * TODO: need lifecycle methods init/destroy
+ */
+public class ScriptComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+
+ public ScriptComponentType() {
+ this.implementationScope = Scope.COMPOSITE;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentTypeLoader.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentTypeLoader.java
new file mode 100644
index 0000000000..1e2f7e31f8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptComponentTypeLoader.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+import java.net.URL;
+
+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.model.ComponentType;
+
+/**
+ * ComponentType loader for script components
+ */
+public class ScriptComponentTypeLoader extends ComponentTypeLoaderExtension<ScriptImplementation> {
+
+ public ScriptComponentTypeLoader() {
+ }
+
+ @Override
+ protected Class<ScriptImplementation> getImplementationClass() {
+ return ScriptImplementation.class;
+ }
+
+ public void load(ScriptImplementation implementation, DeploymentContext deploymentContext) throws LoaderException {
+
+ String sideFile = getSideFileName(implementation.getScriptName());
+ URL resource = implementation.getClassLoader().getResource(sideFile);
+
+ ScriptComponentType componentType;
+ if (resource == null) {
+ // TODO: or else implement introspection
+ throw new LoaderException("ComponentType side file not found", sideFile);
+ } else {
+ componentType =
+ (ScriptComponentType)loaderRegistry.load(new ScriptComponentType(),
+ resource,
+ ComponentType.class,
+ deploymentContext);
+ }
+ implementation.setComponentType(componentType);
+ }
+
+ protected String getSideFileName(String resourceName) {
+ int lastDot = resourceName.lastIndexOf('.');
+ if (lastDot != -1) {
+ resourceName = resourceName.substring(0, lastDot);
+ }
+ return resourceName + ".componentType";
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementation.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementation.java
new file mode 100644
index 0000000000..96eb1cfd21
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementation.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Model object for a script implementation.
+ */
+public class ScriptImplementation extends Implementation<ScriptComponentType> {
+
+ private String scriptName;
+ private String inlineSrc;
+ private String scriptLanguage;
+ private String scriptClassName;
+ private ClassLoader classLoader;
+
+ public ScriptImplementation(String scriptName, String inlineSrc, String scriptLanguage, String scriptClassName, ClassLoader classLoader) {
+ this.scriptName = scriptName;
+ this.inlineSrc = inlineSrc;
+ this.scriptLanguage = scriptLanguage;
+ this.scriptClassName = scriptClassName;
+ this.classLoader = classLoader;
+ }
+
+ public String getScriptClassName() {
+ return scriptClassName;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public String getScriptLanguage() {
+ return scriptLanguage;
+ }
+
+ public String getInlineSrc() {
+ return inlineSrc;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementationLoader.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementationLoader.java
new file mode 100644
index 0000000000..75e2ecea95
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptImplementationLoader.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+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.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.LoaderUtil;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Loader for handling implementation.script elements. <p/>
+ * <code><implementation.script script="path/foo.py" [language="lang" class="myclass"]></code>
+ */
+public class ScriptImplementationLoader extends LoaderExtension<ScriptImplementation> {
+
+ private static final QName IMPLEMENTATION_SCRIPT = new QName(SCA_NS, "implementation.script");
+
+ @Constructor( {"registry"})
+ public ScriptImplementationLoader(@Reference LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_SCRIPT;
+ }
+
+ public ScriptImplementation load(ModelObject mo, XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String scriptName = reader.getAttributeValue(null, "script");
+ if (scriptName != null && scriptName.length() < 1) {
+ scriptName = null;
+ }
+
+ String scriptLanguage = reader.getAttributeValue(null, "language");
+ if (scriptLanguage == null || scriptLanguage.length() < 1) {
+ int i = scriptName.lastIndexOf('.');
+ if (i > 0) {
+ scriptLanguage = scriptName.substring(i + 1);
+ }
+ }
+ if (scriptLanguage == null || scriptLanguage.length() < 1) {
+ throw new LoaderException("unable to determine script language");
+ }
+
+ String scriptClassName = reader.getAttributeValue(null, "class");
+
+ String scriptSrc = null;
+// String scriptSrc = reader.getElementText();
+// if (scriptSrc != null && scriptSrc.length() < 1) {
+// scriptSrc = null;
+// }
+ if (scriptName == null && scriptSrc == null) {
+ throw new MissingResourceException("no 'script' attribute or inline script source");
+ }
+ if (scriptName != null && scriptSrc != null) {
+ throw new MissingResourceException("cannot use both 'script' attribute and inline script");
+ }
+
+ LoaderUtil.skipToEndElement(reader);
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+
+ ScriptImplementation impl = new ScriptImplementation(scriptName, scriptSrc, scriptLanguage, scriptClassName, cl);
+
+ registry.loadComponentType(impl, deploymentContext);
+
+ return impl;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptInvoker.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptInvoker.java
new file mode 100644
index 0000000000..e7c2e656a2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/ScriptInvoker.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extension.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.script.Invocable;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.InvalidConversationSequenceException;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Perform the actual script invocation
+ * TODO: move vertually all of this to SPI TargetInvokerExtension
+ */
+@SuppressWarnings("deprecation")
+public class ScriptInvoker<T> extends TargetInvokerExtension {
+
+ protected Object clazz;
+ protected String operationName;
+
+ private final AtomicComponent<T> component;
+ private final ScopeContainer scopeContainer;
+ protected InstanceWrapper<T> target;
+ protected boolean stateless;
+
+ public ScriptInvoker(String operationName,
+ AtomicComponent component,
+ ScopeContainer scopeContainer,
+ WorkContext workContext) {
+
+ this.operationName = operationName;
+ this.component = component;
+ this.scopeContainer = scopeContainer;
+ stateless = Scope.STATELESS == scopeContainer.getScope();
+
+ // TODO: support script classes
+ }
+
+ public Object invokeTarget(Object payload, short sequence, WorkContext workContext) throws InvocationTargetException {
+ Object contextId = workContext.getIdentifier(scopeContainer.getScope());
+ try {
+
+ InstanceWrapper<T> wrapper = getInstance(sequence, contextId);
+ Invocable scriptEngine = (Invocable)wrapper.getInstance();
+
+ Object ret;
+ if (clazz == null) {
+ ret = scriptEngine.invokeFunction(operationName, (Object[])payload);
+ } else {
+ ret = scriptEngine.invokeMethod(clazz, operationName, (Object[])payload);
+ }
+
+ scopeContainer.returnWrapper(component, wrapper, contextId);
+ if (sequence == END) {
+ // if end conversation, remove resource
+ scopeContainer.remove(component);
+ }
+
+ return ret;
+
+ } catch (ScriptException e) {
+ throw new InvocationTargetException(e);
+ } catch (ComponentException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ @Override
+ public ScriptInvoker clone() throws CloneNotSupportedException {
+ try {
+ ScriptInvoker invoker = (ScriptInvoker)super.clone();
+ invoker.target = null;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+
+ /**
+ * Resolves the target service instance or returns a cached one
+ */
+ protected InstanceWrapper<T> getInstance(short sequence, Object contextId) throws TargetException {
+ switch (sequence) {
+ case NONE:
+ if (cacheable) {
+ if (target == null) {
+ target = scopeContainer.getWrapper(component, contextId);
+ }
+ return target;
+ } else {
+ return scopeContainer.getWrapper(component, contextId);
+ }
+ case START:
+ assert !cacheable;
+ return scopeContainer.getWrapper(component, contextId);
+ case CONTINUE:
+ case END:
+ assert !cacheable;
+ return scopeContainer.getAssociatedWrapper(component, contextId);
+ default:
+ throw new InvalidConversationSequenceException("Unknown sequence type", String.valueOf(sequence));
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireObjectFactory.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireObjectFactory.java
new file mode 100644
index 0000000000..9cec649cdb
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireObjectFactory.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+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<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private Wire wire;
+ private ProxyService proxyService;
+ // the cache of proxy interface method to operation mappings
+ private Map<Method, ChainHolder> 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<T> interfaze, Wire wire, ProxyService proxyService)
+ {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.proxyService = proxyService;
+ this.mappings = WireUtils.createInterfaceToWireMapping(interfaze, wire); // TODO
+ 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<Method, ChainHolder> newChains = new HashMap<Method, ChainHolder>(mappings.size());
+ for (Map.Entry<Method, ChainHolder> entry : mappings.entrySet()) {
+ newChains.put(entry.getKey(), entry.getValue().clone());
+ }
+ return interfaze.cast(proxyService.createProxy(interfaze, wire, newChains));
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireUtils.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireUtils.java
new file mode 100644
index 0000000000..b63c3c881a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/java/org/apache/tuscany/extension/script/WireUtils.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extension.script;
+
+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<Method, ChainHolder> createInterfaceToWireMapping(Class<?> interfaze, Wire wire) {
+ Map<Operation<?>, InvocationChain> invocationChains = wire.getInvocationChains();
+
+ Map<Method, ChainHolder> chains = new HashMap<Method, ChainHolder>(invocationChains.size());
+ for (Map.Entry<Operation<?>, 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 RuntimeException(operation.getName());
+ }
+ }
+ return chains;
+ }
+
+ public static Map<Method, InvocationChain> createInterfaceToWireMapping2(Class<?> interfaze, Wire wire) {
+ Map<PhysicalOperationDefinition, InvocationChain> invocationChains = wire.getPhysicalInvocationChains();
+
+ Map<Method, InvocationChain> chains = new HashMap<Method, InvocationChain>(invocationChains.size());
+ for (Map.Entry<PhysicalOperationDefinition, InvocationChain> entry : invocationChains.entrySet()) {
+ PhysicalOperationDefinition operation = entry.getKey();
+ try {
+ Method method = findMethod2(interfaze, operation);
+ chains.put(method, entry.getValue());
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(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/old/contrib/implementation-script/container.jsr223/src/main/resources/META-INF/sca/script.system.scdl b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/resources/META-INF/sca/script.system.scdl
new file mode 100644
index 0000000000..b075194f7f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/main/resources/META-INF/sca/script.system.scdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.extension.script.jsr223"
+ autowire="true">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.extension.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.extension.script.ScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.extension.script.ScriptComponentBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptImplementationLoaderTestCase.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..60495b6763
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptImplementationLoaderTestCase.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extension.script;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.easymock.EasyMock;
+
+public class ScriptImplementationLoaderTestCase extends TestCase {
+
+ private String XML_START =
+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/2.0-alpha\">";
+ private String XML_END = "</composite>";
+
+ public void testLoadNamedScript() throws XMLStreamException, LoaderException {
+
+ String xml =
+ XML_START + "<implementation.script script=\"path/foo.py\" language=\"myLang\" class=\"myClass\" />"
+ + XML_END;
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ reader.next();
+
+ LoaderRegistry reg = EasyMock.createNiceMock(LoaderRegistry.class);
+ ScriptImplementationLoader loader = new ScriptImplementationLoader(reg);
+ DeploymentContext deploymentContext = EasyMock.createNiceMock(DeploymentContext.class);
+ ScriptImplementation impl = loader.load(null, reader, deploymentContext);
+
+ assertEquals("path/foo.py", impl.getScriptName());
+ assertEquals("myLang", impl.getScriptLanguage());
+ assertEquals("myClass", impl.getScriptClassName());
+ assertNull(impl.getInlineSrc());
+ }
+
+// public void testLoadInlineScript() throws XMLStreamException, LoaderException {
+//
+// String xml =
+// XML_START + "<implementation.script language=\"myLang\" class=\"myClass\">"
+// + "myScriptSrc"
+// + "</implementation.script>"
+// + XML_END;
+// XMLInputFactory factory = XMLInputFactory.newInstance();
+// XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xml));
+// reader.next();
+// reader.next();
+//
+// LoaderRegistry reg = EasyMock.createNiceMock(LoaderRegistry.class);
+// ScriptImplementationLoader loader = new ScriptImplementationLoader(reg);
+// DeploymentContext deploymentContext = EasyMock.createNiceMock(DeploymentContext.class);
+// ScriptImplementation impl = loader.load(null, reader, deploymentContext);
+//
+// assertNull(impl.getScriptName());
+// assertEquals("myScriptSrc", impl.getInlineSrc());
+// assertEquals("myLang", impl.getScriptLanguage());
+// assertEquals("myClass", impl.getScriptClassName());
+// }
+}
diff --git a/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptInvokerTestCase.java b/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptInvokerTestCase.java
new file mode 100644
index 0000000000..26373595f6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/container.jsr223/src/test/java/org/apache/tuscany/extension/script/ScriptInvokerTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extension.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.easymock.EasyMock;
+
+public class ScriptInvokerTestCase extends TestCase {
+
+ private ScriptEngine engine;
+ private ScopeContainer mockScopeContainer;
+
+ public void testInvokeTarget() throws ScriptException, InvocationTargetException {
+// engine.eval("function foo(s) {return 'hi ' + s; }");
+// ScriptInvoker invoker = new ScriptInvoker("foo", null, mockScopeContainer, null);
+// assertEquals("hi petra", invoker.invokeTarget(engine, new Object[] {"petra"}));
+ }
+
+ @Override
+ public void setUp() {
+ ScriptEngineManager manager = new ScriptEngineManager();
+ engine = manager.getEngineByExtension("js");
+ mockScopeContainer = EasyMock.createNiceMock(ScopeContainer.class);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/LICENSE.txt b/sandbox/old/contrib/implementation-script/databinding.e4x/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/implementation-script/databinding.e4x/NOTICE.txt b/sandbox/old/contrib/implementation-script/databinding.e4x/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/databinding.e4x/pom.xml.off b/sandbox/old/contrib/implementation-script/databinding.e4x/pom.xml.off
new file mode 100644
index 0000000000..8952eb749a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/pom.xml.off
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.script</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-e4x</artifactId>
+ <name>Apache Tuscany JavaScript E4X DataBinding</name>
+ <description>Apache Tuscany JavaScript E4X DataBinding</description>
+
+ <repositories>
+ <!-- This is for the WSO2 Rhino core build until Rhino cuts a new release -->
+ <repository>
+ <id>wso2-thilina</id>
+ <url>http://www-lk.wso2.com/~thilina/repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <layout>legacy</layout>
+ </repository>
+
+ <!-- This is for the WSO2 E4X impl -->
+ <repository>
+ <id>wso2</id>
+ <url>http://dist.wso2.org/maven</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mozilla.javascript</groupId>
+ <artifactId>js-core</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.wso2.javascript.rhino</groupId>
+ <artifactId>js-axiom</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java
new file mode 100644
index 0000000000..82d4f0b9a4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.mozilla.javascript.xmlimpl.XML;
+import org.osoa.sca.annotations.Service;
+
+@Service(Transformer.class)
+public class E4X2OMElement extends TransformerExtension<XML, OMElement> implements PullTransformer<XML, OMElement> {
+
+ public OMElement transform(XML source, TransformationContext context) {
+ return (OMElement)source.getAxiomFromXML();
+ }
+
+ public Class getSourceType() {
+ return XML.class;
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
new file mode 100644
index 0000000000..06c578866d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.SimpleType2JavaTransformer;
+import org.mozilla.javascript.xmlimpl.XML;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Transformer to convert data from a simple java bject to OMElement
+ */
+@Service(Transformer.class)
+public class E4X2Object extends SimpleType2JavaTransformer<XML> {
+
+ private E4X2OMElement e4x2om;
+
+ public E4X2Object() {
+ e4x2om = new E4X2OMElement();
+ }
+
+ @Override
+ protected String getText(XML source) {
+ return e4x2om.transform(source, null).getText();
+ }
+
+ public Class getSourceType() {
+ return XML.class;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
new file mode 100644
index 0000000000..8118cd26e3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.databinding.WrapperHandler;
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.mozilla.javascript.xmlimpl.XML;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * DataBinding for E4X
+ *
+ * This requires Rhino using the WSO2 Axiom based E4X impl
+ */
+@Service(DataBinding.class)
+public class E4XDataBinding extends DataBindingExtension {
+
+ public static final String NAME = XML.class.getName();
+
+ public E4XDataBinding() {
+ super(NAME, XML.class);
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.extension.DataBindingExtension#getWrapperHandler()
+ */
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new E4XWrapperHandler();
+ }
+
+ /**
+ * Treat E4X as pass-by-ref
+ */
+ public Object copy(Object source) {
+ return source;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java
new file mode 100644
index 0000000000..94c22db8b9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.WrapperHandler;
+import org.apache.tuscany.spi.model.ElementInfo;
+import org.mozilla.javascript.xmlimpl.XML;
+
+/**
+ * OMElement wrapper handler implementation
+ */
+public class E4XWrapperHandler implements WrapperHandler<XML> {
+
+ private OMFactory factory;
+ private OMElement2E4X om2e4x;
+ private E4X2OMElement e4x2om;
+
+ public E4XWrapperHandler() {
+ this.factory = OMAbstractFactory.getOMFactory();
+ om2e4x = new OMElement2E4X();
+ e4x2om = new E4X2OMElement();
+ }
+
+ public XML create(ElementInfo element, TransformationContext context) {
+ OMElement wrapper = factory.createOMElement(element.getQName(), null);
+ return om2e4x.transform(wrapper, null);
+ }
+
+ public void setChild(XML wrapper, int i, ElementInfo childElement, Object value) {
+ OMElement omWrapper = e4x2om.transform(wrapper, null);
+ OMElement element = e4x2om.transform((XML)value, null);
+ QName elementName = childElement.getQName();
+ OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(childElement.getQName().getLocalPart());
+ omWrapper.addChild(element);
+ }
+
+ public List getChildren(XML wrapper) {
+ OMElement omWrapper = e4x2om.transform(wrapper, null);
+ List<Object> elements = new ArrayList<Object>();
+ for (Iterator i = omWrapper.getChildElements(); i.hasNext();) {
+ elements.add(om2e4x.transform((OMElement)i.next(), null));
+ }
+ return elements;
+ }
+
+ public Object getChild(XML wrapper, int i, ElementInfo element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java
new file mode 100644
index 0000000000..6ab0e42a75
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.xmlimpl.XML;
+import org.osoa.sca.annotations.Service;
+
+@Service(Transformer.class)
+public class OMElement2E4X extends TransformerExtension<OMElement, XML> implements PullTransformer<OMElement, XML> {
+
+ private ScriptableObject scope;
+
+ public OMElement2E4X() {
+ Context cx = Context.enter();
+ try {
+
+ this.scope = cx.initStandardObjects();
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ public Class getTargetType() {
+ return XML.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+ public XML transform(OMElement source, TransformationContext context) {
+ Context cx = Context.enter();
+ try {
+
+ return (XML)cx.newObject(scope, "XML", new Object[] {source});
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
new file mode 100644
index 0000000000..b66208d54e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.extensions.script.databinding.e4x;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.Java2SimpleTypeTransformer;
+import org.apache.tuscany.spi.model.ElementInfo;
+import org.mozilla.javascript.xmlimpl.XML;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ */
+@Service(Transformer.class)
+public class Object2E4X extends Java2SimpleTypeTransformer<XML> {
+
+ private OMFactory factory;
+ private OMElement2E4X om2e4x;
+
+ public Object2E4X() {
+ factory = OMAbstractFactory.getOMFactory();
+ om2e4x = new OMElement2E4X();
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XML.class;
+ }
+
+ @Override
+ protected XML createElement(ElementInfo element, String literal, TransformationContext context) {
+ OMElement omElement = factory.createOMElement(element.getQName(), null);
+ factory.createOMText(omElement, literal);
+ return om2e4x.transform(omElement, context);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl
new file mode 100644
index 0000000000..66f7d9d9c1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- This is the copy ot be included by other extensions -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.extensions.script.databinding.e4x.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.script</group>
+ <name>databinding-e4x</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.e4x">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4XDataBinding" />
+ </component>
+
+ <component name="transformer.E4X2OMElement">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.OMElement2E4X" />
+ </component>
+
+ <component name="transformer.Object2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.Object2E4X" />
+ </component>
+
+ <component name="transformer.E4X2Object">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2Object" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..3428495aa6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- This is the copy ot be included by other extensions -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.extensions.script.databinding.e4x.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.script</group>
+ <name>databinding-e4x</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.e4x">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4XDataBinding" />
+ </component>
+
+ <component name="transformer.E4X2OMElement">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.OMElement2E4X" />
+ </component>
+
+ <component name="transformer.Object2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.Object2E4X" />
+ </component>
+
+ <component name="transformer.E4X2Object">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2Object" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..9156c64d54
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.e4x">
+ <include name="org.apache.tuscany.databinding.e4x.include" scdlLocation="databinding.e4x.scdl" />
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-script/pom.xml.off b/sandbox/old/contrib/implementation-script/pom.xml.off
new file mode 100644
index 0000000000..a3f88f9f46
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/pom.xml.off
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.script</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany SCA Extensions for Script Languages</name>
+
+ <modules>
+ <module>container.jsr223</module>
+ <module>testing</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/LICENSE.txt b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/implementation-script/testing/groovy/helloworld/NOTICE.txt b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/testing/groovy/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/pom.xml.off
new file mode 100644
index 0000000000..667a382c0d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>testing-groovy</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>groovy-helloworld</artifactId>
+ <name>Apache Tuscany Groovy HelloWorld</name>
+ <description>Apache Tuscany Groovy HelloWorld</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
new file mode 100644
index 0000000000..dc9f4c578f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting(String name);
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..6f7413bce4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting(String name) {
+ return greeting + " " + name;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..101e60936f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloService">
+ <interface.java class="org.apache.tuscany.sca.runtime.itest.smoketest.HelloService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.groovy b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.groovy
new file mode 100644
index 0000000000..c3e71d5a32
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/HelloWorld.groovy
@@ -0,0 +1,4 @@
+def getGreeting(name) {
+ return 'groovyHello ' + name
+}
+
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..2befdb4e77
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptTestingComposite">
+
+ <component name="Hello">
+ <implementation.script script="HelloWorld.groovy"/>
+ <!-- property name="greeting">Hello</property -->
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
new file mode 100644
index 0000000000..cf25d15ea1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class BasicTestComponent extends TestCase {
+ @Reference
+ public HelloService hello;
+
+ public void testGreeting() {
+ assertEquals("groovyHello petra", hello.getGreeting("petra"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..b51f3fa431
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/helloworld/src/test/resources/itest.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="TestHarnessComposite">
+
+ <include name="ITestSmoketestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.runtime.itest.smoketest.BasicTestComponent"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/groovy/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/groovy/pom.xml.off
new file mode 100644
index 0000000000..4ff059ebb0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/groovy/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>testing-groovy</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Script Container Testing for Groovy</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/LICENSE.txt b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/implementation-script/testing/javascript/helloworld/NOTICE.txt b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/testing/javascript/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/pom.xml.off
new file mode 100644
index 0000000000..f54fa5252c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/pom.xml.off
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>testing-javascript</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>javascript-helloworld</artifactId>
+ <name>Apache Tuscany JavaScript HelloWorld</name>
+ <description>Apache Tuscany JavaScript HelloWorld</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
new file mode 100644
index 0000000000..dc9f4c578f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting(String name);
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..6f7413bce4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting(String name) {
+ return greeting + " " + name;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..101e60936f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloService">
+ <interface.java class="org.apache.tuscany.sca.runtime.itest.smoketest.HelloService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.js b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.js
new file mode 100644
index 0000000000..95313c4022
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/HelloWorld.js
@@ -0,0 +1,3 @@
+function getGreeting(name) {
+ return "jsHello " + name;
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..94a9a90a31
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptTestingComposite">
+
+ <component name="Hello">
+ <implementation.script script="HelloWorld.js"/>
+ <!-- property name="greeting">Hello</property -->
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
new file mode 100644
index 0000000000..dd9ef28609
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class BasicTestComponent extends TestCase {
+ @Reference
+ public HelloService hello;
+
+ public void testGreeting() {
+ assertEquals("jsHello petra", hello.getGreeting("petra"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..b51f3fa431
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/helloworld/src/test/resources/itest.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="TestHarnessComposite">
+
+ <include name="ITestSmoketestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.runtime.itest.smoketest.BasicTestComponent"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/javascript/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/javascript/pom.xml.off
new file mode 100644
index 0000000000..ec6d94fd4b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/javascript/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>testing-javascript</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Script Container Testing for JavaScript</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/LICENSE.txt b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/implementation-script/testing/jruby/helloworld/NOTICE.txt b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/testing/jruby/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/pom.xml.off
new file mode 100644
index 0000000000..59320a5e46
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/pom.xml.off
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>testing-jruby</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jruby-helloworld</artifactId>
+ <name>Apache Tuscany JRuby HelloWorld</name>
+ <description>Apache Tuscany JRuby HelloWorld</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>0.9.8</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
new file mode 100644
index 0000000000..dc9f4c578f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting(String name);
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..6f7413bce4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting(String name) {
+ return greeting + " " + name;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..101e60936f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloService">
+ <interface.java class="org.apache.tuscany.sca.runtime.itest.smoketest.HelloService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.rb b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.rb
new file mode 100644
index 0000000000..3aaf41452c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/HelloWorld.rb
@@ -0,0 +1,3 @@
+def getGreeting(name)
+ return "rbHello " + name
+end
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..7007117b5e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptTestingComposite">
+
+ <component name="Hello">
+ <implementation.script script="HelloWorld.rb"/>
+ <!-- property name="greeting">Hello</property -->
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
new file mode 100644
index 0000000000..eb0dc07e44
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class BasicTestComponent extends TestCase {
+ @Reference
+ public HelloService hello;
+
+ public void testGreeting() {
+ assertEquals("rbHello petra", hello.getGreeting("petra"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..b51f3fa431
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/helloworld/src/test/resources/itest.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="TestHarnessComposite">
+
+ <include name="ITestSmoketestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.runtime.itest.smoketest.BasicTestComponent"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/jruby/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/jruby/pom.xml.off
new file mode 100644
index 0000000000..0c439e1fc4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jruby/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>testing-jruby</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Script Container Testing for JRuby</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/LICENSE.txt b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/implementation-script/testing/jython/helloworld/NOTICE.txt b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-script/testing/jython/helloworld/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/pom.xml.off
new file mode 100644
index 0000000000..4d4b19500e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>testing-jython</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jython-helloworld</artifactId>
+ <name>Apache Tuscany Jython HelloWorld</name>
+ <description>Apache Tuscany Jython HelloWorld</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
new file mode 100644
index 0000000000..dc9f4c578f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting(String name);
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..6f7413bce4
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting(String name) {
+ return greeting + " " + name;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.componentType b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.componentType
new file mode 100644
index 0000000000..101e60936f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloService">
+ <interface.java class="org.apache.tuscany.sca.runtime.itest.smoketest.HelloService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.py b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.py
new file mode 100644
index 0000000000..d02c73f7c8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/HelloWorld.py
@@ -0,0 +1,3 @@
+def getGreeting(name):
+ return 'pyHello ' + name
+
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..4e18fcf229
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptTestingComposite">
+
+ <component name="Hello">
+ <implementation.script script="HelloWorld.py"/>
+ <!-- property name="greeting">Hello</property -->
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
new file mode 100644
index 0000000000..61d4674961
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class BasicTestComponent extends TestCase {
+ @Reference
+ public HelloService hello;
+
+ public void testGreeting() {
+ assertEquals("pyHello petra", hello.getGreeting("petra"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..b51f3fa431
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/helloworld/src/test/resources/itest.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="TestHarnessComposite">
+
+ <include name="ITestSmoketestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.runtime.itest.smoketest.BasicTestComponent"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-script/testing/jython/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/jython/pom.xml.off
new file mode 100644
index 0000000000..a3d558aa4e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/jython/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>testing-jython</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Script Container Testing for Jython</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-script/testing/pom.xml.off b/sandbox/old/contrib/implementation-script/testing/pom.xml.off
new file mode 100644
index 0000000000..bcaede9199
--- /dev/null
+++ b/sandbox/old/contrib/implementation-script/testing/pom.xml.off
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.script</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.script.testing</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Script Container Tests</name>
+
+ <properties>
+ <!-- version the SCA API that we implement -->
+ <scaSpecVersion>1.0</scaSpecVersion>
+
+ <!-- version the Apache Tuscany kernel that the runtimes work with -->
+ <kernelVersion>2.0-alpha-incubating</kernelVersion>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <modules>
+ <module>groovy</module>
+ <module>javascript</module>
+ <module>jruby</module>
+ <module>jython</module>
+ </modules>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-spring/container/.ruleset b/sandbox/old/contrib/implementation-spring/container/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/implementation-spring/container/LICENSE.txt b/sandbox/old/contrib/implementation-spring/container/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/implementation-spring/container/NOTICE.txt b/sandbox/old/contrib/implementation-spring/container/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/implementation-spring/container/README.txt b/sandbox/old/contrib/implementation-spring/container/README.txt
new file mode 100755
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sandbox/old/contrib/implementation-spring/container/pom.xml.off b/sandbox/old/contrib/implementation-spring/container/pom.xml.off
new file mode 100755
index 0000000000..44b68b3d2a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <name>Apache Tuscany Spring Framework Container</name>
+ <description>Container for managing Spring composites</description>
+ <packaging>jar</packaging>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java
new file mode 100644
index 0000000000..343c76d7a2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.Resource;
+
+/**
+ * An <code>ApplicationContext</code> specialization that registers namespace handlers for SCA elements
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAApplicationContext extends AbstractXmlApplicationContext {
+ public static final String APP_CONTEXT_PROP = "org.springframework.sca.application.context";
+ private Resource appXml;
+
+ public SCAApplicationContext(ApplicationContext parent, Resource appXml) {
+ super(parent);
+ this.appXml = appXml;
+ refresh();
+ }
+
+ protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
+ ClassLoader cl = getClassLoader();
+ beanDefinitionReader.setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(cl));
+ }
+
+ protected Resource[] getConfigResources() {
+ return new Resource[]{appXml};
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java
new file mode 100644
index 0000000000..b524846fc9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+
+/**
+ * Overrides the default Spring namespace resolver to automatically register {@link ScaNamespaceHandler} instead of
+ * requiring a value to be supplied in a Spring configuration
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SCANamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
+ private static final String SCA_NAMESPACE = "http://www.springframework.org/schema/sca";
+
+ private ScaNamespaceHandler handler;
+
+ public SCANamespaceHandlerResolver(ClassLoader classLoader) {
+ super(classLoader);
+ handler = new ScaNamespaceHandler(/*componentType*/);
+ }
+
+ public SCANamespaceHandlerResolver(String handlerMappingsLocation, ClassLoader classLoader) {
+ super(classLoader, handlerMappingsLocation);
+ handler = new ScaNamespaceHandler(/*componentType*/);
+ }
+
+ public NamespaceHandler resolve(String namespaceUri) {
+ if (SCA_NAMESPACE.equals(namespaceUri)) {
+ return handler;
+ }
+ return super.resolve(namespaceUri);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java
new file mode 100644
index 0000000000..5ce7edbc2d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ * Handler for the &lt;sca:&gt; namespace in an application context
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaNamespaceHandler extends NamespaceHandlerSupport {
+
+ public ScaNamespaceHandler() {
+ init();
+ }
+
+ public final void init() {
+ registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
+ registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java
new file mode 100644
index 0000000000..d872cefc3a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the &lt;sca:reference&gt; element
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, this is handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java
new file mode 100644
index 0000000000..567904d6cf
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the &lt;sca:service/&gt; element
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java
new file mode 100644
index 0000000000..4aad7cd35c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * Thrown when a service contract Operation cannot be mapped to a method on a Spring Bean class
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanMethodNotFound extends TargetInvokerCreationException {
+ private Operation operation;
+
+ public BeanMethodNotFound(Operation operation) {
+ super("Bean method not found");
+ this.operation = operation;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
new file mode 100644
index 0000000000..9647b8857a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+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.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.springframework.core.io.Resource;
+
+/**
+ * Creates a {@link org.apache.tuscany.container.spring.impl.SpringCompositeComponent} from an assembly model
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeBuilder extends ComponentBuilderExtension<SpringImplementation> {
+
+ public Component build(ComponentDefinition<SpringImplementation> componentDefinition, DeploymentContext context)
+ throws BuilderException {
+ URI uri = componentDefinition.getUri();
+ SpringImplementation implementation = componentDefinition.getImplementation();
+ Resource resource = implementation.getApplicationResource();
+ ClassLoader cl = implementation.getClassLoader();
+ return new SpringCompositeComponent(uri, resource, proxyService, null, cl);
+ }
+
+ protected Class<SpringImplementation> getImplementationType() {
+ return SpringImplementation.class;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
new file mode 100644
index 0000000000..d11c3054b7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.extension.CompositeComponentExtension;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.physical.PhysicalWireSourceDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireTargetDefinition;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+
+import org.apache.tuscany.container.spring.context.SCAApplicationContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.io.Resource;
+
+/**
+ * A composite implementation responsible for managing Spring application contexts.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeComponent extends CompositeComponentExtension {
+ private static final String[] EMPTY_ARRAY = new String[0];
+ private AbstractApplicationContext springContext;
+ private Resource resource;
+ private ProxyService proxyService;
+ private ClassLoader loader;
+
+ /**
+ * Creates a new composite
+ *
+ * @param uri the uri of the SCA composite
+ * @param resource a resource pointing to the application context
+ * @param propertyValues the values of this composite's Properties
+ */
+ public SpringCompositeComponent(URI uri,
+ Resource resource,
+ ProxyService proxyService,
+ Map<String, Document> propertyValues,
+ ClassLoader loader) {
+ super(uri);
+ this.resource = resource;
+ this.proxyService = proxyService;
+ this.loader = loader;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ TargetInvoker invoker = super.createTargetInvoker(targetName, operation);
+ if (invoker != null) {
+ return invoker;
+ }
+ // no service found, wire to a bean using the service name as the bean name
+ ServiceContract contract = operation.getServiceContract();
+ Method method;
+ try {
+ method = findMethod(contract.getInterfaceClass(), operation);
+ } catch (NoSuchMethodException e) {
+ throw new BeanMethodNotFound(operation);
+ }
+ return new SpringInvoker(targetName, method, this);
+ }
+
+ public List<Wire> getWires(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWires(List<Wire> wires) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ConfigurableApplicationContext getApplicationContext() {
+ return springContext;
+ }
+
+ public void prepare() {
+ // TODO handle only references with a composite binding
+ }
+
+ public void start() {
+ super.start();
+ for (SCAObject child : children.values()) {
+ child.start();
+ }
+ if (springContext == null) {
+ SCAParentApplicationContext scaApplicationContext = new SCAParentApplicationContext();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ // FIXME this is horrible
+ Thread.currentThread().setContextClassLoader(loader);
+ springContext = new SCAApplicationContext(scaApplicationContext, resource);
+ springContext.start();
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+
+ }
+ }
+ }
+
+ public void stop() {
+ super.stop();
+ springContext.stop();
+ }
+
+ public <T> T getBean(Class<T> serviceInterface, String name) {
+ return serviceInterface.cast(springContext.getBean(name));
+ }
+
+ /**
+ * Used in unit testing
+ */
+ void setSpringContext(AbstractApplicationContext springContext) {
+ this.springContext = springContext;
+ }
+
+ /**
+ * TODO remove need for inner class as SCA.getParent() has been removed and no longer clashes with
+ * ApplicaitonContext.getParent
+ */
+ private class SCAParentApplicationContext implements ApplicationContext {
+
+ public Object getBean(String name) throws BeansException {
+ return getBean(name, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getBean(String name, Class requiredType) throws BeansException {
+ SCAObject object = children.get(name); // keep cast due to compiler error
+ if (object == null) {
+ return null;
+ }
+ Class<?> type = null;
+ if (object instanceof Reference) {
+ Reference reference = (Reference) object;
+ Wire wire = null;
+ if (!reference.getReferenceBindings().isEmpty()) {
+ // FIXME JFM provide a better way for the runtime to select the binding as opposed to the first one
+ wire = reference.getReferenceBindings().get(0).getWire();
+ type = wire.getSourceContract().getInterfaceClass();
+ }
+ if (requiredType != null && requiredType.isAssignableFrom(type)) {
+ // need null check since Spring may pass in a null
+ throw new BeanNotOfRequiredTypeException(name, requiredType, type);
+ }
+ return proxyService.createProxy(type, wire);
+ } else if (object instanceof ServiceBinding) {
+ ServiceBinding serviceBinding = (ServiceBinding) object;
+ type = serviceBinding.getWire().getSourceContract().getInterfaceClass();
+ if (requiredType != null && requiredType.isAssignableFrom(type)) {
+ // need null check since Spring may pass in a null
+ throw new BeanNotOfRequiredTypeException(name, requiredType, type);
+ }
+ return proxyService.createProxy(type, serviceBinding.getWire());
+ } else {
+ throw new AssertionError("Illegal object type [" + name + "]");
+ }
+ }
+
+ public boolean containsBean(String name) {
+ return children.get(name) != null;
+ }
+
+ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+ return children.get(name) != null;
+ }
+
+ public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class getType(String name) throws NoSuchBeanDefinitionException {
+ return null;
+ }
+
+ public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
+ return EMPTY_ARRAY;
+ }
+
+ public ApplicationContext getParent() {
+ return null;
+ }
+
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+ return null;
+ }
+
+ public String getDisplayName() {
+ return getUri().toString();
+ }
+
+ public long getStartupDate() {
+ return 0;
+ }
+
+ public boolean containsBeanDefinition(String beanName) {
+ return false;
+ }
+
+ public int getBeanDefinitionCount() {
+ return 0;
+ }
+
+ public String[] getBeanDefinitionNames() {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type) {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
+ return new String[0];
+ }
+
+ public Map getBeansOfType(Class type) throws BeansException {
+ return null;
+ }
+
+ public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans)
+ throws BeansException {
+ return null;
+ }
+
+ public BeanFactory getParentBeanFactory() {
+ return null;
+ }
+
+ public boolean containsLocalBean(String name) {
+ return false;
+ }
+
+ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
+ return null;
+ }
+
+ public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public void publishEvent(ApplicationEvent event) {
+
+ }
+
+ public Resource[] getResources(String locationPattern) throws IOException {
+ return new Resource[0];
+ }
+
+ public Resource getResource(String location) {
+ return null;
+ }
+
+ public ClassLoader getClassLoader() {
+ // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
+ // resource loading mechanism is exposed right now.
+ return this.getClass().getClassLoader();
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
new file mode 100644
index 0000000000..ff0b215f4a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import org.springframework.beans.BeansException;
+
+/**
+ * Dispatches to an operation on a Spring bean. Since Spring manages bean lifecycle and scope through resolution in the
+ * target proxy, the invoker can safely cache the target proxy.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringInvoker implements TargetInvoker {
+ private SpringCompositeComponent component;
+ // default to true since Spring handles resolution
+ private boolean cacheable = true;
+ private String beanName;
+ private Method method;
+ // caching is thread-safe since Spring handles resolution
+ private Object bean;
+
+ public SpringInvoker(String beanName, Method method, SpringCompositeComponent component) {
+ this.beanName = beanName;
+ this.method = method;
+ this.component = component;
+ }
+
+ public Object invokeTarget(final Object object, final short sequence) throws InvocationTargetException {
+ if (bean == null) {
+ try {
+ bean = component.getBean(Object.class, beanName);
+ if (bean == null) {
+ throw new InvocationTargetException(new TargetNotFoundException(beanName));
+ }
+ } catch (BeansException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ try {
+ if (object != null && !object.getClass().isArray()) {
+ return method.invoke(bean, object);
+ } else {
+ return method.invoke(bean, (Object[]) object);
+ }
+ } catch (IllegalAccessException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+
+ public SpringInvoker clone() throws CloneNotSupportedException {
+ SpringInvoker invoker = (SpringInvoker) super.clone();
+ invoker.bean = null;
+ return invoker;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java
new file mode 100644
index 0000000000..150440cdf9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.loader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.Constants;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.runtime.webapp.WebappRuntimeInfo;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Loader for handling Spring <implementation.spring> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringImplementationLoader extends LoaderExtension<SpringImplementation> {
+ private static final QName IMPLEMENTATION_SPRING = new QName("http://www.osoa.org/xmlns/sca/1.0",
+ "implementation.spring");
+ private static final String APPLICATION_CONTEXT = "applicationContext.xml";
+ private static final QName SERVICE_ELEMENT = new QName(Constants.SCA_NS, "service");
+ private static final QName REFERENCE_ELEMENT = new QName(Constants.SCA_NS, "reference");
+
+ private final RuntimeInfo runtimeInfo;
+
+ public SpringImplementationLoader(@Reference LoaderRegistry registry, @Reference RuntimeInfo runtimeInfo) {
+ super(registry);
+ this.runtimeInfo = runtimeInfo;
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_SPRING;
+ }
+
+ @SuppressWarnings("unchecked")
+ public SpringImplementation load(
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String locationAttr = reader.getAttributeValue(null, "location");
+ if (locationAttr == null) {
+ throw new MissingResourceException("No location supplied");
+ }
+
+ ClassLoader classLoader = deploymentContext.getClassLoader();
+ SpringImplementation implementation = new SpringImplementation(classLoader);
+ implementation.setApplicationResource(getApplicationContextResource(locationAttr, classLoader));
+ registry.loadComponentType(implementation, deploymentContext);
+ SpringComponentType type = implementation.getComponentType();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (SERVICE_ELEMENT.equals(qname)) {
+ ServiceDefinition service =
+ (ServiceDefinition) registry.load(null, reader, deploymentContext);
+ if (!type.isExposeAllBeans()) {
+ URI name = service.getUri();
+ if (!type.getServiceDeclarations().containsKey(name)) {
+ throw new LoaderException("No service defined in Spring context for ", name.toString());
+ }
+ }
+ type.getDeclaredServices().put(service.getUri(), service);
+ } else if (REFERENCE_ELEMENT.equals(qname)) {
+ ReferenceDefinition reference =
+ (ReferenceDefinition) registry.load(null, reader, deploymentContext);
+ type.getDeclaredReferences().put(reference.getUri(), reference);
+ }
+ break;
+ case END_ELEMENT:
+ if (IMPLEMENTATION_SPRING.equals(reader.getName())) {
+ return implementation;
+ }
+ }
+ }
+ }
+
+ protected Resource getApplicationContextResource(String locationAttr, ClassLoader cl) throws LoaderException {
+ assert runtimeInfo != null;
+ File manifestFile = null;
+ File appXmlFile;
+ File locationFile = new File(locationAttr);
+
+// if (!locationFile.isAbsolute()) {
+// locationFile = new File(runtimeInfo.getApplicationRootDirectory(), locationAttr);
+// }
+ if (!locationFile.exists()) {
+ // FIXME hack
+ URL url;
+ if (runtimeInfo instanceof WebappRuntimeInfo) {
+ try {
+ url = ((WebappRuntimeInfo) runtimeInfo).getServletContext().getResource(locationAttr);
+ } catch (MalformedURLException e) {
+ throw new LoaderException(e);
+ }
+ } else {
+ url = cl.getResource(locationAttr);
+ }
+ if (url != null) {
+ return new UrlResource(url);
+ }
+ throw new MissingResourceException(locationFile.toString());
+ }
+
+ if (locationFile.isDirectory()) {
+ try {
+ manifestFile = new File(locationFile, "META-INF/MANIFEST.MF");
+ if (manifestFile.exists()) {
+ Manifest mf = new Manifest(new FileInputStream(manifestFile));
+ Attributes mainAttrs = mf.getMainAttributes();
+ String appCtxPath = mainAttrs.getValue("Spring-Context");
+ if (appCtxPath != null) {
+ appXmlFile = new File(locationFile, appCtxPath);
+ if (appXmlFile.exists()) {
+ return new UrlResource(appXmlFile.toURL());
+ }
+ }
+ }
+ // no manifest-specified Spring context, use default
+ appXmlFile = new File(locationFile, APPLICATION_CONTEXT);
+ if (appXmlFile.exists()) {
+ return new UrlResource(appXmlFile.toURL());
+ }
+ } catch (IOException e) {
+ throw new LoaderException("Error reading manifest " + manifestFile);
+ }
+ } else {
+ try {
+ JarFile jf = new JarFile(locationFile);
+ JarEntry je;
+ Manifest mf = jf.getManifest();
+ if (mf != null) {
+ Attributes mainAttrs = mf.getMainAttributes();
+ String appCtxPath = mainAttrs.getValue("Spring-Context");
+ if (appCtxPath != null) {
+ je = jf.getJarEntry(appCtxPath);
+ if (je != null) {
+ // TODO return a Spring specific Resouce type for jars
+ return new UrlResource(new URL("jar:" + locationFile.toURL() + "!/" + appCtxPath));
+ }
+ }
+ }
+ je = jf.getJarEntry(APPLICATION_CONTEXT);
+ if (je != null) {
+ return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!" + APPLICATION_CONTEXT));
+ }
+ } catch (IOException e) {
+ // bad archive
+ // TODO: create a more appropriate exception type
+ throw new MissingResourceException(locationAttr, e);
+ }
+ }
+
+ throw new
+
+ MissingResourceException(APPLICATION_CONTEXT);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java
new file mode 100644
index 0000000000..21fb5b7b5b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.loader;
+
+import java.io.IOException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Reference;
+
+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.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.Property;
+
+import org.apache.tuscany.container.spring.model.ReferenceDeclaration;
+import org.apache.tuscany.container.spring.model.ServiceDeclaration;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.springframework.core.io.Resource;
+
+/**
+ * Introspects a Spring XML configuration file for its component type information. Other loader implementations may
+ * support alternative Spring configuration mechanisms.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringXMLComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation> {
+ private static final String SCA_NS = "http://www.springframework.org/schema/sca";
+ private static final QName SERVICE_ELEMENT = new QName(SCA_NS, "service");
+ private static final QName REFERENCE_ELEMENT = new QName(SCA_NS, "reference");
+ private static final QName BEANS_ELEMENT = new QName("http://www.springframework.org/schema/beans", "beans");
+
+ public SpringXMLComponentTypeLoader(@Reference LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ @Override
+ protected Class<SpringImplementation> getImplementationClass() {
+ return SpringImplementation.class;
+ }
+
+ public void load(
+ SpringImplementation implementation,
+ DeploymentContext context) throws LoaderException {
+ if (implementation.getComponentType() != null) {
+ // FIXME hack since the builder registry loads the implementation type and the Spring implementation
+ // loader needs to as well. The second call is done by the builder registry and we just ignore it.
+ return;
+ }
+ SpringComponentType<Property<?>> type = new SpringComponentType<Property<?>>();
+ Resource resource = implementation.getApplicationResource();
+ loadFromXML(type, resource, context);
+ implementation.setComponentType(type);
+ }
+
+ private void loadFromXML(SpringComponentType<Property<?>> type, Resource resource, DeploymentContext context)
+ throws LoaderException {
+ XMLStreamReader reader;
+ try {
+ XMLInputFactory factory = context.getXmlFactory();
+ ClassLoader cl = context.getClassLoader();
+ reader = factory.createXMLStreamReader(resource.getInputStream());
+ boolean exposeAllBeans = true;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (SERVICE_ELEMENT.equals(qname)) {
+ exposeAllBeans = false;
+ String name = reader.getAttributeValue(SCA_NS, "name");
+ Class<?> serviceType;
+ try {
+ serviceType = cl.loadClass(reader.getAttributeValue(SCA_NS, "type"));
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Error loading service class", name, e);
+ }
+ String target = reader.getAttributeValue(SCA_NS, "target");
+ type.addServiceDeclaration(new ServiceDeclaration(name, serviceType, target));
+ } else if (REFERENCE_ELEMENT.equals(qname)) {
+ String name = reader.getAttributeValue(SCA_NS, "name");
+ Class<?> serviceType;
+ try {
+ serviceType = cl.loadClass(reader.getAttributeValue(SCA_NS, "type"));
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Error loading service class", name, e);
+ }
+ type.addReferenceDeclaration(new ReferenceDeclaration(name, serviceType));
+ }
+ break;
+ case END_ELEMENT:
+ if (BEANS_ELEMENT.equals(reader.getName())) {
+ type.setExposeAllBeans(exposeAllBeans);
+ return;
+ }
+ }
+ }
+
+ } catch (IOException e) {
+ throw new LoaderException(e);
+ } catch (XMLStreamException e) {
+ throw new LoaderException(e);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java
new file mode 100644
index 0000000000..b53ddbe18f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.model;
+
+/**
+ * Represents a <code>sca:reference<code> declaration in an application context. Used as component type metadata for a
+ * Spring composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceDeclaration {
+ private String name;
+ private Class<?> serviceType;
+
+ public ReferenceDeclaration(String name, Class<?> serviceType) {
+ this.name = name;
+ this.serviceType = serviceType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getServiceType() {
+ return serviceType;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java
new file mode 100644
index 0000000000..4872028215
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.model;
+
+/**
+ * Represents a <code>sca:service<code> declaration in an application context. Used as component type metadata for a
+ * Spring composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceDeclaration {
+ private String name;
+ private Class<?> serviceType;
+ private String target;
+
+ /**
+ * Constructor
+ *
+ * @param name the service name
+ * @param serviceType the service contract type
+ * @param target the name of the target the service is wired to
+ */
+ public ServiceDeclaration(String name, Class<?> serviceType, String target) {
+ this.name = name;
+ this.serviceType = serviceType;
+ this.target = target;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getClazz() {
+ return serviceType;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
new file mode 100644
index 0000000000..e44656046f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Component type information for a Spring composite component implementation type. A component type is associated with
+ * a Spring application context
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringComponentType<P extends Property<?>>
+ extends CompositeComponentType<ServiceDefinition, ReferenceDefinition, P> {
+ private Map<String, ServiceDeclaration> serviceDeclarations = new HashMap<String, ServiceDeclaration>();
+ private Map<String, ReferenceDeclaration> referenceDeclarations = new HashMap<String, ReferenceDeclaration>();
+ private boolean exposeAllBeans;
+
+ public SpringComponentType() {
+ }
+
+ /**
+ * Returns true if all beans in the Spring application context may be service targets or false if service types are
+ * defined
+ */
+ public boolean isExposeAllBeans() {
+ return exposeAllBeans;
+ }
+
+ /**
+ * Sets if all beans in the Spring application context may be service targets or false if service types are defined
+ */
+ public void setExposeAllBeans(boolean exposeAllBeans) {
+ this.exposeAllBeans = exposeAllBeans;
+ }
+
+ /**
+ * Returns the service declarations for the composite
+ *
+ * @return Returns the service declarations for the composite
+ */
+ public Map<String, ServiceDeclaration> getServiceDeclarations() {
+ return serviceDeclarations;
+ }
+
+ /**
+ * Adds a service declaration for the composite
+ */
+ public void addServiceDeclaration(ServiceDeclaration declaration) {
+ serviceDeclarations.put(declaration.getName(), declaration);
+ }
+
+ /**
+ * Returns the reference declarations for the composite
+ *
+ * @return Returns the reference declarations for the composite
+ */
+ public Map<String, ReferenceDeclaration> getReferenceDeclarations() {
+ return referenceDeclarations;
+ }
+
+ /**
+ * Adds a service declarations for the composite
+ */
+ public void addReferenceDeclaration(ReferenceDeclaration declaration) {
+ referenceDeclarations.put(declaration.getName(), declaration);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
new file mode 100644
index 0000000000..4842e75e0e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.model;
+
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Property;
+
+import org.springframework.core.io.Resource;
+
+/**
+ * Represents a composite whose implementation type is a Spring application context.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringImplementation extends Implementation<SpringComponentType<Property<?>>> {
+ private String location;
+ private Resource applicationResource;
+ private ClassLoader classLoader;
+
+ public SpringImplementation(ClassLoader classloader) {
+ this.classLoader = classloader;
+ }
+
+ /**
+ * Returns the classloader of the Spring application context
+ */
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ /**
+ * Returns the path of the Spring application context configuration
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the path of the Spring application context configuration
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /**
+ * Returns the Spring configuration resource for the application context
+ */
+ public Resource getApplicationResource() {
+ return applicationResource;
+ }
+
+ /**
+ * Sets the Spring configuration resource for the application context
+ */
+ public void setApplicationResource(Resource applicationXml) {
+ this.applicationResource = applicationXml;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl
new file mode 100644
index 0000000000..0eb781a5f1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<!--
+ Spring implementation extension configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.launcher.SpringImplementation"
+ autowire="true">
+
+ <!-- <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.spring</group>
+ <name>tuscany-spring</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency> -->
+
+ <component name="spring.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.spring.loader.SpringImplementationLoader"/>
+ </component>
+
+ <component name="spring.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.spring.loader.SpringXMLComponentTypeLoader"/>
+ </component>
+
+ <component name="spring.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringCompositeBuilder"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000000..689b49e2ae
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1,3 @@
+http\://www.springframework.org/schema/sca=org.springframework.sca.config.ScaNamespaceHandler
+
+
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000000..33f7004be9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/sca/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd b/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
new file mode 100644
index 0000000000..3e61ee96dc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.springframework.org/schema/sca"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.springframework.org/schema/sca">
+
+ <xsd:element name="composite">
+ <xsd:complexType>
+ <xsd:attribute name="component" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="sca-adapter-class" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="reference">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="default" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="property">
+ <xsd:complexType>
+ <xsd:attribute name="id" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="service">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="target" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
new file mode 100644
index 0000000000..13b2c684d7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the SCA extensible schema elements for Spring's XML configuration files
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public class SpringConfigSchemaTestCase extends TestCase {
+
+// private ConfigurableApplicationContext applicationContext;
+//
+// public void setUp() {
+// applicationContext =
+// new ScaApplicationContext(null,
+// new ClassPathResource("org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml"));
+// }
+//
+ public void testSCAService() {
+// ScaServiceExporter service = (ScaServiceExporter) applicationContext.getBean("fooService");
+// // FIXME andyp -- this is not really right.
+//// TestBean service = (TestBean) applicationContext.getBean("fooService");
+//// assertEquals("call me", service.echo("call me"));
+ }
+//
+// public void testSCAReference() {
+// ScaServiceProxyFactoryBean pf = (ScaServiceProxyFactoryBean) applicationContext.getBean("&fooReference");
+// assertEquals("fooReference", pf.getReferenceName());
+// TestReference ref = (TestReference) applicationContext.getBean("fooReference");
+//// assertNotNull(ref);
+// }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
new file mode 100644
index 0000000000..4a73b6628b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring;
+
+import java.net.URI;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.builder.WiringException;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+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.container.spring.mock.TestBeanImpl;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.context.support.GenericApplicationContext;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+public final class SpringTestUtils {
+ private SpringTestUtils() {
+ }
+
+ public static <T> ServiceBinding createService(URI uri, Class<T> serviceInterface)
+ throws InvalidServiceContractException, WiringException {
+ return new ServiceBindingExtension(uri) {
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ };
+ }
+
+
+ public static GenericApplicationContext createContext() {
+ GenericApplicationContext ctx = new GenericApplicationContext();
+ BeanDefinition definition = new RootBeanDefinition(TestBeanImpl.class);
+ ctx.registerBeanDefinition("foo", definition);
+ return ctx;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java
new file mode 100644
index 0000000000..f93957cb8b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import org.springframework.core.io.AbstractResource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestClassResource extends AbstractResource {
+ private Class<?> clazz;
+ private String fileName;
+
+ public TestClassResource(Class<?> clazz, String fileName) {
+ this.clazz = clazz;
+ this.fileName = fileName;
+ }
+
+ public String getDescription() {
+ return "test resource";
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return clazz.getResourceAsStream(fileName);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java
new file mode 100644
index 0000000000..b1e5733cd8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.CallableReference;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.model.ServiceContract;
+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.IncompatibleServiceContractException;
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.spring.mock.TestBean;
+import org.easymock.EasyMock;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Verifies wiring from a Spring bean to an SCA composite reference
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ReferenceWiringTestCase extends TestCase {
+
+ public void testInvocation() throws Exception {
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testReferenceContext.xml");
+ Resource resource = new UrlResource(url);
+ URI uri = URI.create("spring");
+ ProxyService proxyService = new MockProxyService();
+ SpringCompositeComponent parent = new SpringCompositeComponent(uri, resource, proxyService, null, loader);
+ Wire wire = EasyMock.createMock(Wire.class);
+ ServiceContract<?> contract = new ServiceContract(TestBean.class) {
+ };
+ EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ReferenceBinding referenceBinding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(referenceBinding.getWire()).andStubReturn(wire);
+ referenceBinding.start();
+ EasyMock.replay(referenceBinding);
+
+ URI referenceUri = URI.create("spring#testReference");
+ ReferenceBinding binding = new ReferenceBindingExtension(referenceUri, null){
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ };
+ binding.setWire(wire);
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getUri()).andReturn(referenceUri).anyTimes();
+ EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
+ reference.start();
+ EasyMock.replay(reference);
+ parent.register(reference);
+ parent.start();
+ TestBean bean = parent.getBean(TestBean.class, "testBean");
+ assertNotNull(bean.getBean());
+ EasyMock.verify(reference);
+ }
+
+ private class MockInvocationHandler implements InvocationHandler {
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return null;
+ }
+ }
+
+ private class MockProxyService implements ProxyService {
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException {
+ ClassLoader cl = interfaze.getClassLoader();
+ Class[] interfaces = new Class[]{interfaze};
+ MockInvocationHandler handler = new MockInvocationHandler();
+ return interfaze.cast(Proxy.newProxyInstance(cl, interfaces, handler));
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, ChainHolder> mapping)
+ throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, List<Wire> wires) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean checkCompatibility(ServiceContract<?> source,
+ ServiceContract<?> target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleServiceContractException {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
new file mode 100644
index 0000000000..fb9d107b71
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.easymock.EasyMock;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeBuilderTestCase extends TestCase {
+
+ /**
+ * Verifies that the builder calls back into the registry to load services and references when no
+ * <code>sca:service</code> tag is specified in the Spring application.xml
+ */
+ public void testImplicitServiceWiring() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ // Configure the mock builder registry
+ BuilderRegistry registry = EasyMock.createMock(BuilderRegistry.class);
+ EasyMock.expect(registry.build(
+ EasyMock.isA(ServiceDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andStubReturn(service);
+ EasyMock.replay(registry);
+ SpringCompositeBuilder builder = new SpringCompositeBuilder();
+ builder.setBuilderRegistry(registry);
+ ComponentDefinition<SpringImplementation> definition = createDefinitionWithService();
+ Component component = builder.build(definition, null);
+ assertNotNull(component);
+ EasyMock.verify(registry);
+ }
+
+ /**
+ * Verifies that the builder calls back into the registry to load services and references when no
+ * <code>sca:reference</code> tag is specified in the Spring application.xml
+ */
+ public void testImplicitReferenceWiring() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ // Configure the mock builder registry
+ BuilderRegistry registry = EasyMock.createMock(BuilderRegistry.class);
+ EasyMock.expect(registry.build(
+ EasyMock.isA(ServiceDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andStubReturn(service);
+ EasyMock.replay(registry);
+ SpringCompositeBuilder builder = new SpringCompositeBuilder();
+ builder.setBuilderRegistry(registry);
+ ComponentDefinition<SpringImplementation> definition = createDefinitionWithReference();
+ Component component = builder.build(definition, null);
+ assertNotNull(component);
+ EasyMock.verify(registry);
+ }
+
+ protected ComponentDefinition<SpringImplementation> createDefinitionWithService() throws Exception {
+ super.setUp();
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testServiceContext.xml");
+ Resource resource = new UrlResource(url);
+ SpringComponentType<Property<?>> type = createComponentTypeWithService();
+ SpringImplementation impl = new SpringImplementation(loader);
+ impl.setComponentType(type);
+ URI uri = URI.create("composite");
+ ComponentDefinition<SpringImplementation> definition = new ComponentDefinition<SpringImplementation>(uri, impl);
+ impl.setApplicationResource(resource);
+ return definition;
+ }
+
+ protected ComponentDefinition<SpringImplementation> createDefinitionWithReference() throws Exception {
+ super.setUp();
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testServiceContext.xml");
+ Resource resource = new UrlResource(url);
+ SpringComponentType<Property<?>> type = createComponentTypeWithReference();
+ SpringImplementation impl = new SpringImplementation(loader);
+ impl.setComponentType(type);
+ URI uri = URI.create("composite");
+ ComponentDefinition<SpringImplementation> definition = new ComponentDefinition<SpringImplementation>(uri, impl);
+ impl.setApplicationResource(resource);
+ return definition;
+ }
+
+ private SpringComponentType<Property<?>> createComponentTypeWithService() {
+ SpringComponentType<Property<?>> componentType = new SpringComponentType<Property<?>>();
+ ServiceDefinition serviceDefinition = new ServiceDefinition();
+ serviceDefinition.setUri(URI.create("fooService"));
+ serviceDefinition.setTarget(URI.create("testBean"));
+ componentType.add(serviceDefinition);
+ return componentType;
+ }
+
+ private SpringComponentType<Property<?>> createComponentTypeWithReference() {
+ SpringComponentType<Property<?>> componentType = new SpringComponentType<Property<?>>();
+ ReferenceDefinition referenceDefinition = new ReferenceDefinition();
+ referenceDefinition.setUri(URI.create("fooReference"));
+ componentType.add(referenceDefinition);
+ return componentType;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
new file mode 100644
index 0000000000..d014d99ad7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+import org.springframework.context.support.AbstractApplicationContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SpringCompositeComponentTestCase extends TestCase {
+ private SpringCompositeComponent component;
+
+ public void testChildStart() throws Exception {
+ AbstractApplicationContext appContext = EasyMock.createNiceMock(AbstractApplicationContext.class);
+ EasyMock.replay(appContext);
+ Service service = EasyMock.createMock(Service.class);
+ URI uri = URI.create("composite#service");
+ EasyMock.expect(service.getUri()).andReturn(uri).atLeastOnce();
+ service.start();
+ EasyMock.replay(service);
+ component.setSpringContext(appContext);
+ component.register(service);
+ component.start();
+ EasyMock.verify(service);
+ }
+
+ public void testTargetInvokerCreation() throws Exception {
+ ServiceContract<Type> contract = new ServiceContract<Type>(Foo.class) {
+ };
+ Operation<Type> operation = new Operation<Type>("operation", null, null, null);
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ operations.put("operation", operation);
+ contract.setOperations(operations);
+ operation.setServiceContract(contract);
+ component.createTargetInvoker("bean", operation);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ URI compositeUri = URI.create("composite");
+ component = new SpringCompositeComponent(compositeUri, null, null, null, null);
+
+ }
+
+ private interface Foo {
+ void operation();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
new file mode 100644
index 0000000000..e4a6ad0eb7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.impl;
+
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies a simple invocation on a Spring bean
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringInvocationTestCase extends TestCase {
+
+ /**
+ * Verifies the invoker can resolve a bean in an application context and call a method l
+ */
+ public void testInvocation() throws Exception {
+ TestBean bean = EasyMock.createMock(TestBean.class);
+ bean.test("bar");
+ EasyMock.expectLastCall();
+ EasyMock.replay(bean);
+ SpringCompositeComponent context = EasyMock.createMock(SpringCompositeComponent.class);
+ EasyMock.expect(context.getBean(Object.class, "foo")).andReturn(bean);
+ EasyMock.replay(context);
+ SpringInvoker invoker = new SpringInvoker("foo", TestBean.class.getMethod("test", String.class), context);
+ Message msg = new MessageImpl();
+ msg.setBody(new String[]{"bar"});
+ invoker.invoke(msg);
+ EasyMock.verify(context);
+ EasyMock.verify(bean);
+ }
+
+
+ private interface TestBean {
+ void test(String msg);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
new file mode 100644
index 0000000000..1c768e53cc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TestBean {
+ String echo(String msg);
+
+ TestBean getBean();
+
+ void setBean(TestBean bean);
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
new file mode 100644
index 0000000000..db04d8bcad
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class TestBeanImpl implements TestBean {
+
+ private TestBean bean;
+
+ public TestBeanImpl() {
+ }
+
+ public String echo(String msg) {
+ return msg;
+ }
+
+ public TestBean getBean() {
+ return bean;
+ }
+
+ public void setBean(TestBean bean) {
+ this.bean = bean;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
new file mode 100644
index 0000000000..73d53bdbb7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
@@ -0,0 +1,8 @@
+package org.apache.tuscany.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TestReference {
+ String echo(String msg);
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml
new file mode 100644
index 0000000000..7fa1ff34b0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl" lazy-init="true">
+ <property name="bean" ref="testReference"/>
+ </bean>
+ <!-- <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestReference"/> -->
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..0b2c92c667
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="spring.test">
+
+ <component name="Spring">
+ <implementation.spring location="META-INF/sca/application-context.xml">
+ <service name="fooService">
+ <binding.test/>
+ <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+ <reference>testBean</reference>
+ </service>
+ <reference name="testReference">
+ <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+ <binding.test/>
+ </reference>
+ </implementation.spring>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml
new file mode 100644
index 0000000000..00cd6fabbc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+ <property name="bean" ref="testReference"/>
+ </bean>
+
+ <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestBean"/>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml
new file mode 100644
index 0000000000..deca82f191
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl
new file mode 100644
index 0000000000..0ef2781492
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="spring.test">
+ <!--
+ <component name="Spring">
+ <implementation.spring location="META-INF/sca/application-context.xml">
+ <service name="fooService">
+ <binding.test/>
+ <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+ <reference>testBean</reference>
+ </service>
+ <reference name="testReference">
+ <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+ <binding.test/>
+ </reference>
+ </implementation.spring>
+ </component> -->
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
new file mode 100644
index 0000000000..127592c1f0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <sca:service name="fooBean" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+ </bean>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
new file mode 100644
index 0000000000..c9a4c7e076
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+ </bean>
+
+ <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBean" target="testBean"/>
+
+ <sca:reference name="fooReference" type="org.apache.tuscany.container.spring.mock.TestReference"/>
+
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml
new file mode 100644
index 0000000000..00dd841ba3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off b/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off
new file mode 100644
index 0000000000..f86c9cc409
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-integration-test</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.spring.spring-integration-test</groupId>
+ <artifactId>spring-integration-test-core</artifactId>
+ <packaging>jar</packaging>
+ <name>Core Integration Test Suite for the Spring Extension</name>
+ <description>Tests core Spring extension functionality</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <configuration>
+ <systemScdl>file:./src/test/resources/system.scdl</systemScdl>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java
new file mode 100644
index 0000000000..9d7bf96cbc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TestBean {
+ String echo(String msg);
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java
new file mode 100644
index 0000000000..4804c1b8b9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestBeanImpl implements TestBean {
+
+ public String echo(String msg) {
+ return msg;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl
new file mode 100644
index 0000000000..f2aa95de6e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="SpringSmoketestComposite">
+
+ <component name="SpringComposite">
+ <implementation.spring location="applicationContext.xml"/>
+ </component>
+
+</composite>
+
+
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java
new file mode 100644
index 0000000000..dd485b8923
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WiringTestComponent {
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java
new file mode 100644
index 0000000000..4a59f03a18
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.extensions.spring;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import junit.framework.TestCase;
+
+/**
+ * Verifies beans contained in a Spring composite are properly wired to as targets.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(WiringTestComponent.class)
+public class WiringTestComponentImpl extends TestCase {
+ private TestBean bean;
+
+ /**
+ * Constructor. Accepts a reference to a Spring Bean
+ *
+ * @param bean the Spring Bean
+ */
+ public WiringTestComponentImpl(@Reference(name = "bean")TestBean bean) {
+ this.bean = bean;
+ }
+
+ /**
+ * Invoke to a target Spring Bean
+ */
+ public void testTargetInvocation() {
+ assertEquals("test", bean.echo("test"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml
new file mode 100644
index 0000000000..6f0f3cfb56
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="TestBean" class="org.apache.tuscany.sca.extensions.spring.TestBeanImpl"/>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..c15c7c3579
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="SpecTestHarnessComposite"
+ autowire="true">
+
+ <include scdlResource="META-INF/sca/spring.composite.scdl"/>
+
+ <component name="WiringTestComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.extensions.spring.WiringTestComponentImpl"/>
+ <reference name="bean" target="SpringComposite/TestBean"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl
new file mode 100644
index 0000000000..9735a1a228
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="SpringCoreIntegrationTestSystemComposite">
+
+ <include name="MavenSystemComposite" scdlResource="META-INF/tuscany/embeddedMaven.scdl"/>
+ <include name="SpringSystemComposite" scdlResource="META-INF/sca/spring.system.scdl"/>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off b/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off
new file mode 100644
index 0000000000..96fd51cf07
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-integration-test</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Spring Integration Tests</name>
+ <description>Integration tests for Spring Integration.</description>
+
+ <properties>
+ <!-- version the Apache Tuscany kernel that the runtimes work with -->
+ <kernelVersion>2.0-alpha2-incubating-SNAPSHOT</kernelVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>verify</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <version>${kernelVersion}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-spring/pom.xml.off b/sandbox/old/contrib/implementation-spring/pom.xml.off
new file mode 100644
index 0000000000..8b3424ec29
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/pom.xml.off
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+ <name>Tuscany Spring Extension</name>
+ <modules>
+ <module>container</module>
+ <module>integration-test</module>
+ <!-- <module>samples</module>-->
+ </modules>
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm-util</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-util</artifactId>
+ <version>2.2.3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <!-- junit version -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml b/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml
new file mode 100644
index 0000000000..bdb19eda9d
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>itest-bindings-bindingsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool JSP Client</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>itest-bindings-bindingscomposite</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>itest-bindings-bindingsutility</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..44801846f6
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Tool Service
+ */
+
+@Remotable
+public interface SCATestToolService {
+
+ public String doOneHopPing(String input);
+
+ public String doTwoHopPing(String input);
+
+ public String doDataTypeTest(String input);
+
+ public String getCallbackBuffer();
+
+ public void clearCallbackBuffer();
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite
new file mode 100644
index 0000000000..ca3ff6494e
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2"
+ name="bindingsclient">
+
+ <!--
+ <reference name="SCATestToolSCAReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/>
+ <binding.sca uri="SCATestToolSCAServiceComponent"/>
+ </reference>
+ -->
+
+ <reference name="SCATestToolWSReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService" />
+ <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)"
+ location="wsdl/testtool.wsdl" />
+ </reference>
+
+ <!--
+ <reference name="SCATestToolEJBReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/>
+ <binding.ejb uri="corbaname:iiop:localhost:2811/NameServiceServerRoot#ejb/scabeta1fvt/scatesttool/SCATestToolServiceHome"/>
+ </reference>
+
+ -->
+</composite>
+
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..7dc608f063
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <element name="doOneHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTest">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTestResponse">
+ <complexType>
+ <sequence>
+ <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="getCallbackBufferResponse">
+ <complexType>
+ <sequence>
+ <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="clearCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="clearCallbackBufferResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="doOneHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="doOneHopPingResponse">
+ <wsdl:part element="tns:doOneHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestResponse">
+ <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferResponse">
+ <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferRequest">
+ <wsdl:part element="tns:getCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingRequest">
+ <wsdl:part element="tns:doTwoHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingResponse">
+ <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferResponse">
+ <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferRequest">
+ <wsdl:part element="tns:clearCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestRequest">
+ <wsdl:part element="tns:doDataTypeTest" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doOneHopPingRequest">
+ <wsdl:part element="tns:doOneHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestToolService">
+ <wsdl:operation name="doOneHopPing">
+ <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" />
+
+ <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" />
+
+ <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" />
+
+ <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" />
+
+ <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" />
+
+ <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="doOneHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doOneHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doOneHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doTwoHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doTwoHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doDataTypeTestRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doDataTypeTestResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="getCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="getCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="clearCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="clearCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestToolService">
+ <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
new file mode 100644
index 0000000000..eb219e4cef
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
@@ -0,0 +1,130 @@
+<%--/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ --%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ * SCATestService.java
+ * written by Chris Ortiz
+ * interface class for basic test service
+ * version .1 9/22/2006
+ *
+ *
+ --%>
+
+
+<HTML>
+<HEAD>
+ <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" session="true" autoFlush="true"
+ isThreadSafe="true" isErrorPage="false"
+ import="org.apache.tuscany.sca.itest.SCATestToolService"
+ import="java.io.PrintWriter"
+ import="java.io.StringWriter"
+ import="org.osoa.sca.CurrentCompositeContext"
+ import="org.osoa.sca.CompositeContext"
+ %>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <META name="GENERATOR" content="IBM Software Development Platform">
+ <TITLE>SCA FVT Test Service Driver</TITLE>
+</HEAD>
+
+<BODY bgcolor="#c8d8f8">
+<H2>SCA FVT Test Tool Client</H2>
+
+<form action="SCATestTool.jsp" method="get"><HR><BR>Choose Binding type:<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="WS"> WS Binding
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="EJB"> EJB Binding
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="SCA" checked> Default Binding<BR><BR><HR>
+ <BR>Check Tests to run:<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping First Composite" checked> Ping First Composite
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping Second Composite"> Ping Second Composite<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Data Type Test"> Data Type Test<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async One Way"> Async One Way&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async Callback"> Async Call Back<BR><BR>
+
+
+ <BR>
+ <INPUT type="submit" value="Run Test"></FORM>
+<BR>
+
+ <%
+
+ String bindingchoice = request.getParameter("bind");
+ String[] selected = request.getParameterValues("test");
+
+ try {
+ SCATestToolService scaTestTool;
+ if (bindingchoice.equals("WS")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolWSReference");
+ } else if (bindingchoice.equals("EJB")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolEJBReference");
+ } else {
+ // assume default binding
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolSCAReference");
+ }
+ if (selected != null && selected.length != 0) {
+ for (int i = 0; i < selected.length; i++) {
+ String value = null;
+ if (null != selected[i] && selected[i].equals("Ping First Composite")) {
+ value = scaTestTool.doOneHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Ping Second Composite")){
+ value = scaTestTool.doTwoHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Data Type Test")){
+ value = scaTestTool.doDataTypeTest("brio");
+ } else if (null != selected[i] && selected[i].equals("Async One Way")){
+ value = "Ut Oh! Test tool not complete for oneway testing";
+ } else if (null != selected[i] && selected[i].equals("Async Callback")){
+ value = "Ut Oh! Test tool not complete for async testing";
+ } else {
+ value = "Ut Oh! unknown test";
+ }
+
+%>
+
+<HR>
+Results from <%=selected[i]%> test with <%=bindingchoice%> binding:
+<P><%=value%>
+ <%
+ } //for
+ } //if
+
+ }catch(Exception e){
+ e.printStackTrace();
+ StringWriter sw= new StringWriter();
+ PrintWriter pw= new PrintWriter(sw);
+
+ e.printStackTrace(pw);
+ pw.flush();
+
+%>
+ Whoops!<BR clear="all">
+<PRE>
+ Exception &quot;<%=e.getClass().getName()%>&quot; Exception message: &quot;<%=e.getMessage()%>&quot;<BR clear="all">
+ <%=sw.toString() %>
+</PRE>
+<% } //catch
+
+%>
+
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..fd58cb8b0e
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,31 @@
+<!--
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ -->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>SCA Test Service Driver</display-name>
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>SCATestTool.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java
new file mode 100644
index 0000000000..6cc72c99a2
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServerTest extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
new file mode 100644
index 0000000000..b5f076b7e8
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.core.test.SCATestCaseRunner;
+import org.apache.tuscany.sca.util.SCATestUtilityServerTest;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class WSBindingsClientTestCase extends TestCase {
+ private SCATestToolService scaTestTool;
+
+ private SCATestCaseRunner toolServer;
+ private SCATestCaseRunner utilityServer;
+
+ // Hops over one composite
+ public void testOneHopPing() throws Throwable {
+ try {
+ assertTrue(scaTestTool.doOneHopPing("brio").contains("brio"));
+ } catch (UndeclaredThrowableException e) {
+ throw (e.getCause());
+ }
+ }
+
+ // Hops over two composites
+ public void testTwoHopPing() {
+ assertTrue(scaTestTool.doTwoHopPing("brio").contains("brio"));
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsclient.composite");
+
+ toolServer = new SCATestCaseRunner(SCATestToolServerTest.class);
+ toolServer.setUp();
+ utilityServer = new SCATestCaseRunner(SCATestUtilityServerTest.class);
+ utilityServer.setUp();
+
+ CompositeContext cc = CurrentCompositeContext.getContext();
+ System.out.println("Composite Name = " + cc.getName());
+ System.out.println(CurrentCompositeContext.getContext());
+ scaTestTool =
+ (SCATestToolService)CurrentCompositeContext.getContext().locateService(SCATestToolService.class,
+ "SCATestToolWSReference");
+ if (scaTestTool == null) {
+ System.out.println("Yo Yo It is null");
+ } else {
+ System.out.println("Yo Yo It is not null: " + scaTestTool);
+ }
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ toolServer.tearDown();
+ utilityServer.tearDown();
+ }
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java
new file mode 100644
index 0000000000..0f6cb912a7
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.api.SCARuntime;
+
+import junit.framework.TestCase;
+
+public class SCATestUtilityServerTest extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8081);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml b/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml
new file mode 100644
index 0000000000..9b99bc8134
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>itest-bindings-bindingscomposite</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Service Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation -->
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java
new file mode 100644
index 0000000000..efe30c4f4e
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Random;
+import java.util.Vector;
+
+import org.apache.tuscany.sca.util.SCATestUtilityService;
+
+public class SCADataTypeHelper {
+
+ Date date;
+ Random ran;
+ SCATestUtilityService scaUtil; // change this to be the service provider
+
+ public SCADataTypeHelper(SCATestUtilityService util) {
+ date = new Date();
+ ran = new Random(date.getTime());
+ scaUtil = util;
+ }
+
+ public StringBuffer test_char() throws SCADataTypeHelperException {
+
+ char x = 'a';
+ x += ran.nextInt(26); // get a char a-z
+ StringBuffer rc = new StringBuffer("\nchar datatype test sending ==> " + x);
+ try {
+ char y = scaUtil.echo_char(x);
+ if (x == y) {
+ rc.append("\nchar successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: char ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_char\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_String() throws SCADataTypeHelperException {
+
+ String x = date.toString();
+ StringBuffer rc = new StringBuffer("\nString datatype test sending ==> " + x);
+ try {
+ String y = scaUtil.echo_String(x);
+ if (x.equals(y)) {
+ rc.append("\nString successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: String ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_String\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_int() throws SCADataTypeHelperException {
+
+ int x = ran.nextInt();
+ StringBuffer rc = new StringBuffer("\nint datatype test sending ==> " + x);
+ try {
+ int y = scaUtil.echo_int(x);
+ if (x == y) {
+ rc.append("\nint successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: int ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_int\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_boolean() throws SCADataTypeHelperException {
+
+ boolean x = ran.nextBoolean();
+ StringBuffer rc = new StringBuffer("\nboolean datatype test sending ==> " + x);
+ try {
+ boolean y = scaUtil.echo_boolean(x);
+ if (x == y) {
+ rc.append("\nboolean successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: boolean ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_boolean\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_long() throws SCADataTypeHelperException {
+
+ long x = ran.nextLong();
+ StringBuffer rc = new StringBuffer("\nlong datatype test sending ==> " + x);
+ try {
+ long y = scaUtil.echo_long(x);
+ if (x == y) {
+ rc.append("\nlong successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: long ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_long\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_short() throws SCADataTypeHelperException {
+
+ short x = (short)ran.nextInt();
+ StringBuffer rc = new StringBuffer("\nshort datatype test sending ==> " + x);
+ try {
+ short y = scaUtil.echo_short(x);
+ if (x == y) {
+ rc.append("\nshort successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: short ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_short\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_float() throws SCADataTypeHelperException {
+
+ float x = ran.nextFloat();
+ StringBuffer rc = new StringBuffer("\nfloat datatype test sending ==> " + x);
+ try {
+ float y = scaUtil.echo_float(x);
+ if (x == y) {
+ rc.append("\nfloat successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: float ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_float " + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_double() throws SCADataTypeHelperException {
+
+ double x = ran.nextDouble();
+ StringBuffer rc = new StringBuffer("\ndouble datatype test sending ==> " + x);
+ try {
+ double y = scaUtil.echo_double(x);
+ if (x == y) {
+ rc.append("\ndouble successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: double ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_double\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_BigInteger() throws SCADataTypeHelperException {
+
+ BigInteger x = new BigInteger(ran.nextInt(32) + 32, ran); // between
+ // 32 - 64
+ // bitLength
+ StringBuffer rc = new StringBuffer("\nBigInteger datatype test sending ==> " + x);
+ try {
+ BigInteger y = scaUtil.echo_BigInteger(x);
+ if (x.equals(y)) {
+ rc.append("\nBigInteger successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigInteger ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigInteger\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_BigDecimal() throws SCADataTypeHelperException {
+
+ BigDecimal x = new BigDecimal(ran.nextDouble());
+ StringBuffer rc = new StringBuffer("\nBigDecimal datatype test sending ==> " + x);
+ try {
+ BigDecimal y = scaUtil.echo_BigDecimal(x);
+ if (x.equals(y)) {
+ rc.append("\nBigDecimal successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigDecimal ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigDecimal\n" + e.toString());
+ }
+ return rc;
+ }
+
+ private StringBuffer test_Vector() throws SCADataTypeHelperException {
+
+ Vector vector = new Vector();
+ vector.addElement("DanW");
+ vector.addElement(new Float(2000F));
+ vector.addElement(new Short((short)11));
+ StringBuffer rc = new StringBuffer("\nVector datatype test sending ==> " + vector.toString());
+ boolean passed = true;
+ try {
+ Vector y = scaUtil.echo_Vector(vector);
+ if (((String)y.elementAt(0)).equals("DanW")) {
+ rc.append("\nVector element 0 string " + y.elementAt(0) + " successfully recieved");
+ } else {
+ passed = false;
+ }
+ if ((((Float)y.elementAt(1)).equals((Float)vector.elementAt(1)))) {
+ rc.append("\nVector element 1 Float " + y.elementAt(1) + " successfully recieved");
+ } else {
+ passed = false;
+ }
+ if (y.elementAt(2).equals(vector.elementAt(2))) {
+ rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " successfully received");
+ } else {
+ passed = false;
+ }
+ if (!passed) {
+ //
+ // one of the tests failed
+ //
+ rc.append("\nVector element 0 (String) " + y.elementAt(0) + " should be \"DanW\"");
+ rc.append("\nVector element 1 (Float) " + y.elementAt(1) + " should be \"2000F\"");
+ rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " should be \"11\"");
+ throw new SCADataTypeHelperException("\n" + rc + "\nDataType exception: Vector ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_Vector\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_GregorianCalendar() throws SCADataTypeHelperException {
+
+ GregorianCalendar x = new GregorianCalendar();
+ StringBuffer rc = new StringBuffer("\nGregorianCalendar datatype test sending ==> " + x.toString());
+ try {
+ GregorianCalendar y = scaUtil.echo_GregorianCalendar(x);
+ if (x.equals(y)) {
+ rc.append("\nGregorianCalendar successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: GregorianCalendar ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_GregorianCalendar\n" + e
+ .toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer doDataType() {
+
+ StringBuffer rc = new StringBuffer();
+ try {
+ rc.append(test_boolean());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_char());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_String());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_int());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString());
+ }
+ try {
+ rc.append(test_long());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_short());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_float());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_double());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_BigInteger());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_BigDecimal());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_Vector());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_GregorianCalendar());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ } catch (Exception e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+
+ return rc;
+ }
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java
new file mode 100644
index 0000000000..074fba8057
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+public class SCADataTypeHelperException extends Exception {
+
+ public SCADataTypeHelperException() {
+ }
+
+ public SCADataTypeHelperException(String msg) {
+ super(msg);
+ }
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..c55e22c905
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+/**
+ * SCA Test Tool Callback Service
+ */
+public interface SCATestToolCallbackService {
+
+ public void pingCallBack(String reply);
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java
new file mode 100644
index 0000000000..44e799a566
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServer {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite");
+
+ try {
+ System.out.println("SCATestTool server started");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ SCARuntime.stop();
+ System.out.println("SCATestTool server stopped");
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..67b7e8eb64
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Tool Service
+ */
+
+@Remotable
+public interface SCATestToolService {
+
+ public String doOneHopPing(String input);
+
+ public String doTwoHopPing(String input);
+
+ public String doDataTypeTest(String input);
+
+ public String getCallbackBuffer();
+
+ public void clearCallbackBuffer();
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java
new file mode 100644
index 0000000000..e207a23927
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+import org.apache.tuscany.sca.util.SCATestUtilityService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * SCA Test Service Implementation
+ */
+
+@Service(SCATestToolService.class)
+public class SCATestToolServiceImpl implements SCATestToolService, SCATestToolCallbackService {
+ @Reference
+ public SCATestUtilityService scaTestUtil;
+
+ private String callbackBuffer = null;
+
+ public String doOneHopPing(String input) {
+ System.out.println("Invoking SCATestToolServiceImpl.doOneHopPing()");
+ StringBuffer rc = new StringBuffer();
+ rc.append("doOneHopPing(): ");
+ rc.append(input);
+ return rc.toString();
+ }
+
+ public String doTwoHopPing(String input) {
+ System.out.println("Invoking SCATestToolServiceImpl.doTwoHopPing()");
+ StringBuffer rc = new StringBuffer();
+ rc.append("doTwoHopPing(): ");
+ rc.append(input);
+ rc.append(" --> ");
+ rc.append(scaTestUtil.ping(input));
+ return rc.toString();
+ }
+
+ public String doDataTypeTest(String input) {
+ StringBuffer rc = new StringBuffer();
+ rc.append("doDataTypeTest(): ");
+ rc.append(input);
+ rc.append(" --> ");
+ SCADataTypeHelper dataHelper = new SCADataTypeHelper(scaTestUtil);
+ rc.append(dataHelper.doDataType());
+ return rc.toString();
+ }
+
+ public void pingCallBack(String reply) {
+ callbackBuffer = reply;
+ }
+
+ public String getCallbackBuffer() {
+ return callbackBuffer;
+ }
+
+ public void clearCallbackBuffer() {
+ callbackBuffer = null;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Vector;
+import java.util.GregorianCalendar;
+
+import org.apache.tuscany.sca.itest.SCATestToolCallbackService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Utility Service
+ */
+
+@Remotable
+public interface SCATestUtilityService {
+ public String ping(String input);
+
+ @Callback(SCATestToolCallbackService.class)
+ public void asyncping();
+
+ public int echo_int(int input);
+
+ public short echo_short(short input);
+
+ public long echo_long(long input);
+
+ public float echo_float(float input);
+
+ public double echo_double(double input);
+
+ public boolean echo_boolean(boolean input);
+
+ public char echo_char(char input);
+
+ public String echo_String(String input);
+
+ public BigDecimal echo_BigDecimal(BigDecimal input);
+
+ public BigInteger echo_BigInteger(BigInteger input);
+
+ public Vector echo_Vector(Vector input);
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input);
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite
new file mode 100644
index 0000000000..0b894bf701
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+
+ <component name="httpserver">
+ <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ <property name="httpPort">8085</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
new file mode 100644
index 0000000000..9b2bb51b9c
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="bindingscomposite">
+
+ <!-- dbsdo:import.sdo location="wsdl/testtool.wsdl" / -->
+ <!-- dbsdo:import.sdo location="wsdl/testutility.wsdl" / -->
+
+ <service name="SCATestToolWSService">
+ <interface.wsdl interface="http://scatesttool.scabeta1fvt#wsdl.interface(SCATestToolService)"
+ wsdli:wsdlLocation="http://scatesttool.scabeta1fvt wsdl/testtool.wsdl" />
+ <reference>SCATestToolWSServiceComponent</reference>
+ <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)"
+ location="wsdl/testtool.wsdl" uri="testtool" />
+ </service>
+
+ <component name="SCATestToolWSServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.SCATestToolServiceImpl" />
+ <reference name="scaTestUtil">SCATestUtilityWSReference</reference>
+ </component>
+
+ <reference name="SCATestUtilityWSReference">
+ <interface.java interface="org.apache.tuscany.sca.util.SCATestUtilityService" />
+ <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)"
+ location="wsdl/testutility.wsdl" />
+ </reference>
+
+
+</composite>
+
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..870af6ac2e
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <element name="doOneHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTest">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTestResponse">
+ <complexType>
+ <sequence>
+ <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="getCallbackBufferResponse">
+ <complexType>
+ <sequence>
+ <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="clearCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="clearCallbackBufferResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="doOneHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="doOneHopPingResponse">
+ <wsdl:part element="tns:doOneHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestResponse">
+ <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferResponse">
+ <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferRequest">
+ <wsdl:part element="tns:getCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingRequest">
+ <wsdl:part element="tns:doTwoHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingResponse">
+ <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferResponse">
+ <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferRequest">
+ <wsdl:part element="tns:clearCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestRequest">
+ <wsdl:part element="tns:doDataTypeTest" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doOneHopPingRequest">
+ <wsdl:part element="tns:doOneHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestToolService">
+ <wsdl:operation name="doOneHopPing">
+ <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" />
+
+ <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" />
+
+ <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" />
+
+ <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" />
+
+ <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" />
+
+ <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="doOneHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doOneHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doOneHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doTwoHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doTwoHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doDataTypeTestRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doDataTypeTestResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="getCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="getCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="clearCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="clearCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestToolService">
+ <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl
@@ -0,0 +1,704 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility">
+ <wsdl:types>
+
+ <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://xml.apache.org/xml-soap" />
+ <element name="pingResponse">
+ <complexType>
+ <sequence>
+ <element name="pingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="asyncping">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="asyncpingResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="echo_int">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_intResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_intReturn" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_short">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_shortResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_shortReturn" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_long">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_longResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_longReturn" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_float">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_floatResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_floatReturn" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_double">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_doubleResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_doubleReturn" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_boolean">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_booleanResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_booleanReturn" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_char">
+ <complexType>
+ <sequence>
+ <element name="input" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_charResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_charReturn" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_String">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_StringResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_StringReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimal">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimalResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigInteger">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigIntegerResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_Vector">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_VectorResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendar">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendarResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ping">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <simpleType name="char">
+ <restriction base="xsd:string">
+ <length value="1" />
+ </restriction>
+ </simpleType>
+ <complexType name="Vector">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="echo_StringRequest">
+ <wsdl:part element="tns:echo_String" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortResponse">
+ <wsdl:part element="tns:echo_shortResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingRequest">
+ <wsdl:part element="tns:asyncping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingResponse">
+ <wsdl:part element="tns:asyncpingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleResponse">
+ <wsdl:part element="tns:echo_doubleResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalResponse">
+ <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortRequest">
+ <wsdl:part element="tns:echo_short" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerRequest">
+ <wsdl:part element="tns:echo_BigInteger" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorRequest">
+ <wsdl:part element="tns:echo_Vector" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingResponse">
+ <wsdl:part element="tns:pingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charResponse">
+ <wsdl:part element="tns:echo_charResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorResponse">
+ <wsdl:part element="tns:echo_VectorResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longRequest">
+ <wsdl:part element="tns:echo_long" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleRequest">
+ <wsdl:part element="tns:echo_double" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalRequest">
+ <wsdl:part element="tns:echo_BigDecimal" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarRequest">
+ <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatResponse">
+ <wsdl:part element="tns:echo_floatResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanRequest">
+ <wsdl:part element="tns:echo_boolean" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanResponse">
+ <wsdl:part element="tns:echo_booleanResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_StringResponse">
+ <wsdl:part element="tns:echo_StringResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatRequest">
+ <wsdl:part element="tns:echo_float" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarResponse">
+ <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intResponse">
+ <wsdl:part element="tns:echo_intResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longResponse">
+ <wsdl:part element="tns:echo_longResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charRequest">
+ <wsdl:part element="tns:echo_char" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingRequest">
+ <wsdl:part element="tns:ping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intRequest">
+ <wsdl:part element="tns:echo_int" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerResponse">
+ <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestUtilityService">
+ <wsdl:operation name="ping">
+ <wsdl:input message="tns:pingRequest" name="pingRequest" />
+
+ <wsdl:output message="tns:pingResponse" name="pingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" />
+
+ <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" />
+
+ <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" />
+
+ <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" />
+
+ <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" />
+
+ <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" />
+
+ <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" />
+
+ <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" />
+
+ <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" />
+
+ <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" />
+
+ <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" />
+
+ <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" />
+
+ <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" />
+
+ <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="ping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="pingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="pingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="asyncpingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="asyncpingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_intRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_intResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_shortRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_shortResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_longRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_longResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_floatRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_floatResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_doubleRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_doubleResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_booleanRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_booleanResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_charRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_charResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_StringRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_StringResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigDecimalRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigDecimalResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigIntegerRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigIntegerResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_VectorRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_VectorResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_GregorianCalendarRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_GregorianCalendarResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestUtilityService">
+ <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java
new file mode 100644
index 0000000000..727eb2332f
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServerTestCase extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml b/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml
new file mode 100644
index 0000000000..3f63e5d2eb
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>itest-bindings-bindingsutility</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Utility Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation -->
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..664fb06930
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+/**
+ * SCA Test Tool Callback Service
+ */
+
+public interface SCATestToolCallbackService {
+
+ public void pingCallBack(String reply);
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java
new file mode 100644
index 0000000000..cd967e275a
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+
+import java.io.IOException;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestUtilityServer {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+
+ try {
+ System.out.println("SCATestUtility server started");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ SCARuntime.stop();
+ System.out.println("SCATestUtility server stopped");
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Vector;
+import java.util.GregorianCalendar;
+
+import org.apache.tuscany.sca.itest.SCATestToolCallbackService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Utility Service
+ */
+
+@Remotable
+public interface SCATestUtilityService {
+ public String ping(String input);
+
+ @Callback(SCATestToolCallbackService.class)
+ public void asyncping();
+
+ public int echo_int(int input);
+
+ public short echo_short(short input);
+
+ public long echo_long(long input);
+
+ public float echo_float(float input);
+
+ public double echo_double(double input);
+
+ public boolean echo_boolean(boolean input);
+
+ public char echo_char(char input);
+
+ public String echo_String(String input);
+
+ public BigDecimal echo_BigDecimal(BigDecimal input);
+
+ public BigInteger echo_BigInteger(BigInteger input);
+
+ public Vector echo_Vector(Vector input);
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input);
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java
new file mode 100644
index 0000000000..e752e4d6e6
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.util.GregorianCalendar;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(SCATestUtilityService.class)
+public class SCATestUtilityServiceImpl implements SCATestUtilityService {
+
+ // private SCATestToolCallbackService utilCallBack;
+
+ /**
+ * The setter used by the runtime to set the callback reference
+ *
+ * @param myServiceCallback
+ */
+
+ // @Callback
+ // public void setCallback(SCATestToolCallbackService utilCallBack) {
+ // this.utilCallBack = utilCallBack;
+ // }
+ public String ping(String input) {
+ System.out.println("Invoking SCATestUtilityServiceImpl.ping()");
+ StringBuffer rc = new StringBuffer();
+
+ try {
+ // get a systems property object
+ Properties sp = System.getProperties();
+ rc.append("Pinged SCA Test Utility Service on: ");
+ // get operating system info
+ rc.append(sp.getProperty("os.name"));
+ rc.append(", " + sp.getProperty("os.version"));
+ // get network info
+ rc.append(" - " + InetAddress.getLocalHost().toString());
+ } catch (Exception e) {
+ System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString());
+ e.printStackTrace();
+ }
+ return rc.toString();
+ }
+
+ public void asyncping() {
+
+ StringBuffer rc = new StringBuffer();
+
+ try {
+ // get a systems property object
+ Properties sp = System.getProperties();
+ rc.append("Pinged SCA Test Utility Service on: ");
+ // get operating system info
+ rc.append(sp.getProperty("os.name"));
+ rc.append(", " + sp.getProperty("os.version"));
+ // get network info
+ rc.append(" - " + InetAddress.getLocalHost().toString());
+ } catch (Exception e) {
+ System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString());
+ e.printStackTrace();
+ }
+ // utilCallBack.pingCallBack(rc.toString());
+ }
+
+ public int echo_int(int input) {
+ int local;
+ local = input;
+ return local;
+ }
+
+ public short echo_short(short input) {
+ short local;
+ local = input;
+ return local;
+ }
+
+ public long echo_long(long input) {
+ long local;
+ local = input;
+ return local;
+ }
+
+ public float echo_float(float input) {
+ float local;
+ local = input;
+ return local;
+ }
+
+ public double echo_double(double input) {
+ double local;
+ local = input;
+ return local;
+ }
+
+ public boolean echo_boolean(boolean input) {
+ boolean local;
+ local = input;
+ return local;
+ }
+
+ public char echo_char(char input) {
+ char local;
+ local = input;
+ return local;
+ }
+
+ public String echo_String(String input) {
+ String local;
+ local = input;
+ return local;
+ }
+
+ public BigDecimal echo_BigDecimal(BigDecimal input) {
+ BigDecimal local;
+ local = input;
+ return local;
+ }
+
+ public BigInteger echo_BigInteger(BigInteger input) {
+ BigInteger local;
+ local = input;
+ return local;
+ }
+
+ public Vector echo_Vector(Vector input) {
+ Vector local;
+ local = input;
+ return local;
+ }
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input) {
+ GregorianCalendar local;
+ local = input;
+ return local;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite
new file mode 100644
index 0000000000..7126b78572
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+
+ <component name="httpserver">
+ <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ <property name="httpPort">8081</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite
new file mode 100644
index 0000000000..4d3d9bc523
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="bindingsutility">
+
+ <!-- dbsdo:import.sdo location="wsdl/testutility.wsdl" / -->
+
+ <service name="SCATestUtilityWSService">
+ <interface.wsdl interface="http://scatestutil.scabeta1fvt#wsdl.interface(SCATestUtilityService)"
+ wsdli:wsdlLocation="http://scatestutil.scabeta1fvt wsdl/testutility.wsdl" />
+ <reference>SCATestUtilityWSServiceComponent</reference>
+ <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)"
+ location="wsdl/testutility.wsdl" uri="testutil" />
+ </service>
+
+ <component name="SCATestUtilityWSServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.util.SCATestUtilityServiceImpl" />
+ </component>
+</composite>
+
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl
@@ -0,0 +1,704 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility">
+ <wsdl:types>
+
+ <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://xml.apache.org/xml-soap" />
+ <element name="pingResponse">
+ <complexType>
+ <sequence>
+ <element name="pingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="asyncping">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="asyncpingResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="echo_int">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_intResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_intReturn" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_short">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_shortResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_shortReturn" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_long">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_longResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_longReturn" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_float">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_floatResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_floatReturn" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_double">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_doubleResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_doubleReturn" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_boolean">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_booleanResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_booleanReturn" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_char">
+ <complexType>
+ <sequence>
+ <element name="input" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_charResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_charReturn" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_String">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_StringResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_StringReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimal">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimalResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigInteger">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigIntegerResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_Vector">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_VectorResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendar">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendarResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ping">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <simpleType name="char">
+ <restriction base="xsd:string">
+ <length value="1" />
+ </restriction>
+ </simpleType>
+ <complexType name="Vector">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="echo_StringRequest">
+ <wsdl:part element="tns:echo_String" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortResponse">
+ <wsdl:part element="tns:echo_shortResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingRequest">
+ <wsdl:part element="tns:asyncping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingResponse">
+ <wsdl:part element="tns:asyncpingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleResponse">
+ <wsdl:part element="tns:echo_doubleResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalResponse">
+ <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortRequest">
+ <wsdl:part element="tns:echo_short" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerRequest">
+ <wsdl:part element="tns:echo_BigInteger" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorRequest">
+ <wsdl:part element="tns:echo_Vector" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingResponse">
+ <wsdl:part element="tns:pingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charResponse">
+ <wsdl:part element="tns:echo_charResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorResponse">
+ <wsdl:part element="tns:echo_VectorResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longRequest">
+ <wsdl:part element="tns:echo_long" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleRequest">
+ <wsdl:part element="tns:echo_double" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalRequest">
+ <wsdl:part element="tns:echo_BigDecimal" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarRequest">
+ <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatResponse">
+ <wsdl:part element="tns:echo_floatResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanRequest">
+ <wsdl:part element="tns:echo_boolean" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanResponse">
+ <wsdl:part element="tns:echo_booleanResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_StringResponse">
+ <wsdl:part element="tns:echo_StringResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatRequest">
+ <wsdl:part element="tns:echo_float" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarResponse">
+ <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intResponse">
+ <wsdl:part element="tns:echo_intResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longResponse">
+ <wsdl:part element="tns:echo_longResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charRequest">
+ <wsdl:part element="tns:echo_char" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingRequest">
+ <wsdl:part element="tns:ping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intRequest">
+ <wsdl:part element="tns:echo_int" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerResponse">
+ <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestUtilityService">
+ <wsdl:operation name="ping">
+ <wsdl:input message="tns:pingRequest" name="pingRequest" />
+
+ <wsdl:output message="tns:pingResponse" name="pingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" />
+
+ <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" />
+
+ <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" />
+
+ <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" />
+
+ <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" />
+
+ <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" />
+
+ <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" />
+
+ <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" />
+
+ <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" />
+
+ <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" />
+
+ <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" />
+
+ <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" />
+
+ <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" />
+
+ <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="ping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="pingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="pingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="asyncpingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="asyncpingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_intRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_intResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_shortRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_shortResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_longRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_longResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_floatRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_floatResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_doubleRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_doubleResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_booleanRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_booleanResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_charRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_charResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_StringRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_StringResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigDecimalRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigDecimalResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigIntegerRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigIntegerResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_VectorRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_VectorResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_GregorianCalendarRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_GregorianCalendarResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestUtilityService">
+ <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java b/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java
new file mode 100644
index 0000000000..66246fc006
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.util;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.api.SCARuntime;
+
+import junit.framework.TestCase;
+
+public class SCATestUtilityServerTestCase extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8081);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/bindings/pom.xml b/sandbox/old/contrib/itest/bindings/pom.xml
new file mode 100644
index 0000000000..e85f560bf2
--- /dev/null
+++ b/sandbox/old/contrib/itest/bindings/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <artifactId>bindingstest</artifactId>
+ <packaging>pom</packaging>
+ <name>SCA FVT Test Tool Suite</name>
+
+
+ <modules>
+ <module>bindingscomposite</module>
+ <module>bindingsutility</module>
+ <module>bindingsclient</module>
+ </modules>
+</project>
diff --git a/sandbox/old/contrib/itest/conversations/pom.xml b/sandbox/old/contrib/itest/conversations/pom.xml
new file mode 100644
index 0000000000..481485efeb
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations</artifactId>
+ <name>Apache Tuscany SCA Conversations Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
new file mode 100644
index 0000000000..640ec22a4f
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
new file mode 100644
index 0000000000..dbe51bcbea
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..8f008fa711
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
new file mode 100644
index 0000000000..546382cfd1
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
new file mode 100644
index 0000000000..9deef312ac
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
new file mode 100644
index 0000000000..1196b6ac0d
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java
new file mode 100644
index 0000000000..11d5ea186b
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
new file mode 100644
index 0000000000..1272c7ab7f
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..4e2c721040
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..1470c699c0
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..8fe7c5b6ba
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..efcbdff06f
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..dca0596b87
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java
new file mode 100644
index 0000000000..b1332833bb
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScope.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScope implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java
new file mode 100644
index 0000000000..90c674c6ac
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+/**
+ *
+ */
+public interface AnotherService {
+
+ public void setService(ServiceReference aServiceReference);
+ public void add(int anInt);
+ public int getCount();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java
new file mode 100644
index 0000000000..027109787a
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AnotherService.class)
+@Scope("CONVERSATION")
+
+public class AnotherServiceImpl implements AnotherService {
+
+ // This is a simple pass-thru service used to test propogation
+ // of ServiceReference and maintenance of Session state.
+
+ private ServiceReference aServiceReference;
+
+ public void add(int anInt) {
+
+ Assert.assertNotNull("AnotherServiceImpl - add ", aServiceReference);
+ ((ConversationsService) aServiceReference).add(anInt);
+
+ }
+
+
+ public void initializeCount() {
+
+ Assert.assertNotNull("AnotherServiceImpl - initializeCount ", aServiceReference);
+ ((ConversationsService) aServiceReference).initializeCount();
+
+ }
+
+
+ public void setService(ServiceReference aRef) {
+
+ Assert.assertNotNull("AnotherServiceImpl - setService ", aRef);
+ aServiceReference = aRef;
+
+ }
+
+
+ public int getCount() {
+
+ Assert.assertNotNull("AnotherServiceImpl - getCount ", aServiceReference);
+ return ((ConversationsService) aServiceReference).getLocalCount();
+ }
+
+
+}
+
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java
new file mode 100644
index 0000000000..18e935e089
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+/**
+ *
+ *
+ */
+public interface ConversationsCallback {
+
+ public void callBackMessage(String aString);
+ public void callBackIncrement(String aString);
+ public void callBackEndSession();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java
new file mode 100644
index 0000000000..ff677db74d
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface ConversationsClient {
+
+ public void run();
+ public int count();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java
new file mode 100644
index 0000000000..389b1f4d93
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface ConversationsClient2 {
+ public String getDateTime();
+
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
new file mode 100644
index 0000000000..54a437e66a
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import java.io.File;
+import java.text.DateFormat;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces={ConversationsClient.class,ConversationsClient2.class})
+
+
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="10 minutes",
+ singlePrincipal=false)
+
+
+public class ConversationsClientImpl implements ConversationsClient, ConversationsClient2, ConversationsCallback {
+
+ @Reference
+ protected ConversationsService aService;
+ @Reference
+ protected AnotherService anotherService;
+ @Reference
+ protected ConversationsLifeCycleService aLifeCycleService;
+ @Context
+ protected ComponentContext myContext;
+ @ConversationID
+ protected String conversationID;
+
+ private Object monitor = new Object();
+ private int count=0;
+ private String message;
+ private String initialState;
+ private int initialCount = 56;
+ private String dateTime;
+ private final static String markerFileName = "target/testConversations_test3_marker";
+
+ public ConversationsClientImpl() {
+ System.out.println("xxxxxxxxxx");
+ }
+
+ public void run() {
+
+ // This tests various aspects of session lifecycle and maintenance of session state.
+ // None of these test are working due to various issues.
+
+ /* test0()
+ This test verifies annotations and API's for ConversationID.
+ */
+ test0(); // - Tuscany-1001.
+
+ /* test1()
+ Test stateful callbacks. Verify that the client�s state is maintained throughout the execution of
+ all callback methods.
+ */
+ test1(); // This test is working for MODULE scope. Cant claim succcess because it needs Conversation scope.
+
+ /* test2()
+ Test each method of starting a session. Test @Init.
+ */
+ test2(); // Tuscany-965, Tuscany-1001
+
+ /* test3()
+ Test each method of ending a session. Test @Destroy.
+ */
+ test3(); // Tuscany-965, Tuscany-1001
+
+ /* test4()
+ Pass an existing service reference with an active session to another service. Verify the session is maintained
+ */
+ test4(); // Tuscany-964, Tuscant-1001
+
+ /* test5()
+ Call the createServiceReferenceForSession() API to get a service reference for the active session.
+ Pass the service reference to another service. Verify the session is maintained.
+ */
+ test5();
+
+ /* test6()
+ * Allow a session to timeout.
+ */
+ test6(); // Tuscany-965, Tuscany-1001
+
+
+ return;
+ }
+
+ private void test0()
+ {
+
+ // Verify that conversationID was injected.
+ Assert.assertNotNull("test0 - conversationID injected", conversationID);
+ System.out.println("ConversationID: " + conversationID);
+
+ //
+ // The client may access the ConversationID by calling getConversationID on a Service Reference.
+ // This also verifies a session was created during injection of this Service Reference.
+ //
+ // TODO: this fails as the cid is null as a conversation has not been started yet (which seems expected to me)
+// ServiceReference<ConversationsService> aServiceserviceRef = myContext.getServiceReference(ConversationsService.class, "aService");
+// System.out.println("aServices cid: " + aServiceserviceRef.getConversationID());
+// Assert.assertNotNull("test0 - ConversationID from service reference", aServiceserviceRef.getConversationID());
+
+ //FIXME Port to the 1.0 spec API
+ //Object aLifeCycleServicesSessionID =((ServiceReference)aLifeCycleService).getSessionID();
+ //Assert.assertNotNull("test0 - ConversationID from LifeCycleService service reference", aLifeCycleServicesSessionID);
+
+ // This will verify the @Init() is working for a session created during injection. See test2().
+ aLifeCycleService.knockKnock("Hello");
+
+ }
+
+ private void test1()
+ {
+
+ //
+ // This test verifies that the state of the client is preserved across method calls. Each
+ // call to the service results in 2 callbacks. One to increment a count and the other to set a string.
+ // At the end of the test the count should equal 5 and the string should be set. Also the original strings
+ // values should be preserved.
+ //
+ //
+ initialState = "Initial State";
+
+ int numCalls = 0;
+
+ for(int i=0; i < 10; i++)
+ {
+ aService.knockKnock("Knock Knock " + ++numCalls);
+ }
+
+ // I want to drive multiple callbacks and then give them time to complete. Don't want to
+ // force serialization. After 20 seconds check the assertions.
+
+ synchronized(monitor)
+ {
+ try
+ {
+ monitor.wait(2000L);
+ }
+ catch (Exception ex)
+ {ex.printStackTrace();}
+ }
+
+ // Here we test for the expected state of several different variables. State needs to be maintained
+ // across method calls to the service. If the same client instance is used then the state should match
+ // the following assertions.
+
+ // instance variable count should equal the number of calls to the backend service. count is incremented
+ // during callback processing.
+ Assert.assertEquals("Conversations - Test1 count", numCalls, count);
+ // The returned message should be like the following.
+ Assert.assertEquals("Conversations - Test1 message", true, message.startsWith("Who's There"));
+ // any initial state set prior to running the callbacks should be maintained.
+ Assert.assertEquals("Conversations - Test1 initialState", "Initial State", initialState);
+ Assert.assertEquals("Conversations - Test1 initialCount", 56, initialCount);
+
+ return;
+
+ }
+
+ private void test2()
+ {
+
+ // Verify the various methods to create a new Session.
+ // Sesssions can be started:
+ //
+ // 1) When a service reference is injected into a client. This is verified in test0().
+ // 2) By the client calling newSession() API with and without a ConversationID.
+ //
+ // Verify init() is called prior to any business methods. This is performed in the Service when any
+ // business methos is called.
+
+ Assert.assertNotNull("current composite context",myContext);
+
+ // This tests creating a conversational session. And that @Init is run prior to business method.
+ ServiceReference aServRef = null;
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService");
+// Assert.assertNotNull("Conversations - Test2 Service Reference 1 not returned", aServRef);
+
+ //FIXME Port to the 1.0 spec API
+ //Get the session ID.
+ //Object aConversationID = aServRef.getSessionID();
+ ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //Create a new session this time specifying a session ID. Verify the seesion id is what was specified.
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService","Test2-12345");
+ Assert.assertNotNull("Conversations - Test2 Service Reference 2 not returned", aServRef);
+ //FIXME Port to the 1.0 spec API
+ //Get the session ID.
+ //Object aConversationID2 = aServRef.getSessionID();
+ //Assert.assertEquals("Conversations - Test2 Session not created with specified ConversationID", "Test2-12345", aConversationID2);
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //FIXME Port to the 1.0 spec API
+ //Assert.assertNotSame("Conversations - Test2 sessions are not different", aConversationID, aConversationID2);
+
+ }
+
+ private void test3()
+ {
+
+ // Note: The @EndSesion and @EndsConversation anotations are not implemented.
+ // So #1 an #2 cannot be done.
+
+ //
+ // Verify the various methods to end a session.
+ // Sesssions can be ended:
+ //
+ // 1) Server operation annotated with @EndsConversation.
+ // 2) Server operation calls an @EndSession annotated callback method.
+ // 3) Servers conversation lifetime times out. This is test6() so its not implimented in the test3 method.
+ // 4) The client calls ServiceReference.endSession();
+ //
+ // Verify @Destroy annotated method get called after completion of the business
+ // method that called the endSession.
+ //
+
+ ConversationsLifeCycleService aConversationsLifeCycleService;
+//FIXME Port to the 1.0 spec API
+// Object aConversationID;
+ Assert.assertNotNull("current composite context",myContext);
+ ServiceReference aServRef;
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #1 - Cannot be done annotation not implimented yet. 12/15/2006
+ //
+
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService");
+ aServRef = null;
+ Assert.assertNotNull("Conversations - Test3-1 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-1 ConversationID not found", aConversationID);
+
+ //Call the business method annotated with @EndsConversation.
+ aConversationsLifeCycleService.endThisSession(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-1 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-1 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #2 - Cannot be done annotation not implimented yet. 12/15/2006
+ //
+
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test3-2 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-2 ConversationID not found", aConversationID);
+
+ //Call the business method that will invoke my @EndSession callback method.
+ aConversationsLifeCycleService.endThisSessionUsingCallback(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-2 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-2 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #4 - Client calls endSession()
+ //
+
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService");
+ aServRef = null;
+ Assert.assertNotNull("Conversations - Test3-4 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-4 ConversationID not found", aConversationID);
+
+ //Call the endSession() API on the Service Reference.
+ //FIXME Port to the 1.0 spec API
+ //aServRef.endSession(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-4 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-4 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+ }
+
+ public void test4()
+ {
+
+ //
+ // This test uses the injected active session for the ConversationsService. It starts a conversation
+ // in this method building up state with a counter. It then passes this reference to another backend service adding
+ // additional state. It then returns and adds more state using original service and then performs the Assertions.
+ //
+
+ aService.initializeCount();
+ aService.add(1);
+ anotherService.setService((ServiceReference)aService);
+ anotherService.add(1);
+ anotherService.add(1);
+ aService.add(1);
+ aService.add(1);
+ int count = anotherService.getCount();
+
+ Assert.assertEquals("test4 - ConversationsClientImpl ", 5, count);
+
+ return;
+ }
+
+
+ public void test5()
+ {
+
+ // The first test verifies that the createServiceReferenceForSession(this) API is functioning.
+ // This is done in the backend serviced as it needs a single interface defined. The 2nd test
+ // uses the variant of this API when > 1 interfaces are implemented.
+ //
+ // The 2nd test obtains a service reference for myself and passes that reference to a backend service.
+ // The backend service then invokes the count() method on my service reference. It then returns
+ // the count that it retrieved. The test then asserts that the count returned from the backend
+ // service matches the client services internal state.
+ //
+
+ Assert.assertNotNull("current composite context",myContext);
+
+ boolean result = aService.createServiceReferenceForSelf();
+ System.out.println("Laa: returned from createServiceReferenceForSelf() " + result);
+ Assert.assertEquals("test5 - createServiceReferenceForSelf",true,result);
+
+ count = 6;
+ int returnCount = 0;
+ //FIXME Port to the 1.0 spec API
+ //ServiceReference myServiceReference = myContext.createServiceReferenceForSession(this,"ConversationsClient2");
+ ServiceReference myServiceReference = null;
+ Assert.assertNotNull("test5 - createServiceReferenceForSession - myContext.createServiceReferenceForSession(this,ConversationsClient);", myServiceReference);
+ returnCount = aService.getCount(myServiceReference);
+
+ Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2)",count,returnCount);
+ String aRemoteDateTime = aService.getDateTime(myServiceReference);
+ Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2 - dateTime)", dateTime, aRemoteDateTime);
+
+ return;
+ }
+
+ public void test6()
+ {
+
+ //
+ // Create a session and allow it to timeout and verify that it did.
+ // Invoking a business method on a service that has timed out should result in
+ // a SessionEndedException.
+ //
+
+ Assert.assertNotNull("current composite context",myContext);
+
+ // This tests creating a conversational session. This service has a maxAge="5 seconds".
+ ServiceReference aServRef;
+ //FIXME Port to the 1.0 spec API
+ //aServRef = myContext.newSession("ConversationsLifeCycleService");
+ aServRef = null;
+ Assert.assertNotNull("Conversations - Test6 Service Reference not returned", aServRef);
+
+ // Run a business method.
+ ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //
+ // wait 10 seconds so session will time out.
+ //
+ try {
+ Thread.sleep(10000L);
+ }
+ catch (InterruptedException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ // Run a busineess method after timeout period has elapsed.
+ boolean sessionEnded = false;
+ try
+ {
+ aConversationsLifeCycleService.knockKnock("Hello");
+ }
+ catch (ConversationEndedException sex)
+ {
+ sessionEnded = true;
+ }
+
+ Assert.assertEquals("Conversations - Test6 Session did not timeout ", true, sessionEnded);
+
+ return;
+ }
+
+
+ public synchronized void callBackIncrement(String aString) {
+
+ count++;
+ System.out.println("Laa: callBackIncrement invoked on client. count = " + count);
+
+ }
+
+ public synchronized void callBackMessage(String aString) {
+
+ message = aString;
+ System.out.println("Laa: callBackIMessage invoked on client. message = " + message);
+
+ }
+
+ // @EndSession - This is for test3() variation #2.
+ public void callBackEndSession() {
+
+ System.out.println("Laa: callBackEndSession method invoked on client.");
+
+ }
+
+ public int count()
+ {
+ return this.count;
+ }
+
+ public String getDateTime() {
+
+ dateTime = DateFormat.getDateTimeInstance().toString();
+ return dateTime;
+
+ }
+
+ private void removeMarkerFile()
+ {
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File(markerFileName);
+ if (aFile.exists())
+ aFile.delete();
+ }
+
+ private boolean isMarkerFilePresent()
+ {
+ File aFile = new File(markerFileName);
+ return aFile.exists();
+ }
+
+
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java
new file mode 100644
index 0000000000..26dfcd9a38
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+@Conversational
+
+/**
+ *
+ */
+public interface ConversationsLifeCycleService {
+
+ public String knockKnock(String aString);
+ public void endThisSession();
+ public void endThisSessionUsingCallback();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java
new file mode 100644
index 0000000000..7f38e356f6
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationsLifeCycleService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="5 seconds")
+
+// This is a short-lived conversational service.
+
+public class ConversationsLifeCycleServiceImpl implements ConversationsLifeCycleService {
+
+ @Callback
+ protected ConversationsCallback callback;
+
+ private String state = "NOT READY";
+ private final static String markerFileName = "target/testConversations_test3_marker";
+
+
+ public String knockKnock(String aString) {
+
+ // Prior to any business methods being invoked the state must have been set to READY using the @Init.
+ System.out.println("ConversationsLifeCycleServiceImpl.knockKnock - State = " + state);
+ Assert.assertEquals("ConversationsLifeCycleServiceImpl.knockKnock - not in READY state ", "READY", state);
+
+ return "Who's There!";
+ }
+
+ @Init
+ public void init()
+ {
+ state = "READY";
+ System.out.println("ConversationsLifeCycleServiceImpl.init()");
+ }
+
+
+ @Destroy
+ public void destroy()
+ {
+ state = "DESTROYED";
+
+ File aFile = new File(markerFileName);
+ try
+ {
+ aFile.createNewFile();
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Error Creating " + markerFileName);
+ ex.printStackTrace();
+ }
+ System.out.println("ConversationsLifeCycleServiceImpl.destroy()");
+ }
+
+// @EndsConversation
+ public void endThisSession() {
+ //This method will end the current session by annotation.
+ System.out.println("ConversationsLifeCycleServiceImpl.endThisSession()");
+
+ }
+
+ public void endThisSessionUsingCallback() {
+
+ //This method will end the current session by a callback method annotated with @EndSession.
+ callback.callBackEndSession();
+ System.out.println("ConversationsLifeCycleServiceImpl.endThisSessionUsingCallback()");
+ }
+
+}
+
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java
new file mode 100644
index 0000000000..f878e22bf8
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+@Conversational
+
+/**
+ *
+ */
+public interface ConversationsService {
+
+ public void knockKnock(String aString);
+ public void add(int anInt);
+ public void initializeCount();
+ public int getCount(ServiceReference aServiceReference);
+ public int getLocalCount();
+ public String getDateTime(ServiceReference aServiceReference);
+ public boolean createServiceReferenceForSelf();
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java
new file mode 100644
index 0000000000..45fc68308b
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationsService.class)
+@Scope("CONVERSATION")
+
+public class ConversationsServiceImpl implements ConversationsService {
+
+ @Context
+ protected ComponentContext context;
+
+ @Callback
+ protected ConversationsCallback callback;
+ private int count=0;
+
+ public void knockKnock(String aString) {
+
+ try
+ {
+ count++;
+ //System.out.println("ConversationsServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There " + count);
+ callback.callBackIncrement("Add one please");
+ //System.out.println("ConversationsServiceImpl responses sent");
+ return;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public int getCount(ServiceReference aServiceReference)
+ {
+
+ //
+ // Invoke a method on the service reference and return back the result.
+ //
+
+ int count=0;
+ try
+ {
+ count = ((ConversationsClient) aServiceReference).count();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return count;
+
+ }
+
+ public int getLocalCount()
+ {
+
+ //
+ // Return my localc instance count. This is used for test4.
+ //
+
+ return count;
+
+ }
+
+ public String getDateTime(ServiceReference aServiceReference)
+ {
+
+ //
+ // Invoke a method on the service reference and return back the result.
+ //
+
+ String dateTime;
+ dateTime = ((ConversationsClient2) aServiceReference).getDateTime();
+ return dateTime;
+
+ }
+
+ public void add(int anInt) {
+
+ count +=anInt;
+
+ }
+
+ public void initializeCount() {
+
+ count =0;
+
+ }
+
+ public boolean createServiceReferenceForSelf() {
+
+ // This is done here because we need to test getting a ServiceReference
+ // from a component that implements a single interface. The client in this test
+ // impliments 2 interfaces to test the variant of this that takes interface name as an argumnet.
+
+ boolean aBoolean = false;
+
+ ServiceReference myServiceReference = null;
+
+ try
+ {
+ myServiceReference = context.createSelfReference(ConversationsService.class);
+ System.out.println("Laa: Created Service Reference for Session:" + myServiceReference);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+
+ if (myServiceReference != null)
+ {
+ aBoolean = true;
+ System.out.println("Laa: Service Reference is not null");
+ }
+
+ return aBoolean;
+ }
+
+
+}
+
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite
new file mode 100644
index 0000000000..abd1c35ced
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationAge.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationAgeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationAgeComponentImpl"/>
+ </component>
+
+ <component name="ConversationIdleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationMaxIdleComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite
new file mode 100644
index 0000000000..93b44c260f
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/resources/ConversationsTest.composite
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationsTest">
+
+ <component name="ConversationsClient">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsClientImpl"/>
+ <reference name="aService" target="ConversationsService"/>
+ <reference name="anotherService" target="AnotherService"/>
+ <reference name="aLifeCycleService" target="ConversationLifeCycleService"/>
+ </component>
+
+ <component name="ConversationsService">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsServiceImpl"/>
+ </component>
+
+ <component name="AnotherService">
+ <implementation.java class="org.apache.tuscany.sca.test.AnotherServiceImpl"/>
+ </component>
+
+ <component name="ConversationLifeCycleService">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsLifeCycleServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite
new file mode 100644
index 0000000000..e61eb08194
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/resources/conversationId.composite
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationIdComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationIdComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite b/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite
new file mode 100644
index 0000000000..43259f67c3
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/main/resources/conversational.composite
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScope"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java
new file mode 100644
index 0000000000..1138d2e1f0
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationIdService;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationIdTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversationId.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testConversationId() {
+ ConversationIdService service =
+ domain.getService(ConversationIdService.class, "ConversationIdComponent");
+ Assert.assertNotNull(service.getCIDField());
+ Assert.assertNotNull(service.getCIDSetter());
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java
new file mode 100644
index 0000000000..d7c6a0ed41
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+public class ConversationalAgeTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval", "2");
+ domain = SCADomain.newInstance("ConversationAge.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.clearProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval");
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testMaxAge() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(3100);
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ }
+
+ @Test
+ public void testAgeExpired() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(1100);
+ try {
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ Assert.fail();
+ } catch (ConversationEndedException e) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testMaxIdle() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationIdleComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(3100);
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
new file mode 100644
index 0000000000..8480e04028
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationalJ2SETestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testStatefulConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateful");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+
+ @Test
+ public void testStatelessConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateless");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
new file mode 100644
index 0000000000..245f0a5597
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationalTestCase {
+
+ private SCADomain domain;
+ private ConversationalClient conversationalStatelessClientStatelessService;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+ private ConversationalClient conversationalStatefulClientStatelessService;
+ private ConversationalClient conversationalStatefulClientStatefulService;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java
new file mode 100644
index 0000000000..fdbb1f9dca
--- /dev/null
+++ b/sandbox/old/contrib/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTestCaseFIXME.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class ConversationsTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private ConversationsClient aConversationsClient;
+
+ public void testConversations() {
+ aConversationsClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ConversationsTest.composite");
+
+ aConversationsClient =
+ domain.getService(ConversationsClient.class,
+ "ConversationsClient/ConversationsClient");
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/pom.xml b/sandbox/old/contrib/itest/interop-xsq-client/pom.xml
new file mode 100644
index 0000000000..c31cce8fc3
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-interop-clients</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>interop-client-webserviceXSQ</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Interop Testing - Clients - webserviceXSQ</name>
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ <argLine>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${sca.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+
+
+</project>
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt b/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/main/resources/META-INF/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java b/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java
new file mode 100644
index 0000000000..f2a7b198a1
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/java/interop/ClientTestCase.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package interop;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate a
+ * simple HelloWorld service component and invoke it.
+ */
+public class ClientTestCase extends SCATestCase {
+ private Object serviceProxy;
+
+ // old tc
+ // public void testGetQuote() throws ConfigurationException,
+ // SecurityException, NoSuchMethodException, IllegalArgumentException,
+ // IllegalAccessException, InvocationTargetException {
+ //
+ // TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null);
+ // tuscany.start();
+ // ModuleContext moduleContext = CurrentModuleContext.getContext();
+ //
+ // Object serviceProxy = moduleContext.locateService("webserviceXSQ");
+ // Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] {
+ // String.class });
+ //
+ // String sqResponse = (String) m.invoke(serviceProxy, "IBM");
+ //
+ // assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
+ //
+ // tuscany.stop();
+ // }
+
+ public void testGetQuote() throws IllegalArgumentException, IllegalAccessException,
+ InvocationTargetException, SecurityException, NoSuchMethodException {
+ Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] {String.class});
+
+ String sqResponse = (String)m.invoke(serviceProxy, "IBM");
+
+ assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ setApplicationSCDL(getClass(), "META-INF/sca/test.scdl");
+
+ addExtension("test.exts", getClass().getClassLoader()
+ .getResource("META-INF/tuscany/test-extensions.scdl"));
+
+ super.setUp();
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ serviceProxy = compositeContext.locateService(Object.class, "webserviceXSQ");
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl
new file mode 100644
index 0000000000..22b3b90623
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/sca/test.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="composite.webserviceXSQ">
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/sq.wsdl"/>
+
+ <reference name="webserviceXSQ">
+ <interface.wsdl interface="http://www.webserviceX.NET/#wsdl.interface(StockQuoteSoap)" wsdli:wsdlLocation="http://www.webserviceX.NET/ wsdl/sq.wsdl" />
+ <binding.ws endpoint="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)"
+ location="wsdl/sq.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl
new file mode 100644
index 0000000000..fb208f56ab
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/binding.axis2.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>axis2</group>
+ <name>axis2-kernel</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
new file mode 100644
index 0000000000..e4fe956e61
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
new file mode 100644
index 0000000000..61753384b4
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
new file mode 100644
index 0000000000..84538dab8b
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>wsdl4j</group>
+ <name>wsdl4j</name>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.ws.commons</group>
+ <name>XmlSchema</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl
new file mode 100644
index 0000000000..355b663a1b
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/META-INF/tuscany/test-extensions.scdl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="binding.axis2.scdl"/>
+
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl
new file mode 100644
index 0000000000..0408a60297
--- /dev/null
+++ b/sandbox/old/contrib/itest/interop-xsq-client/src/test/resources/wsdl/sq.wsdl
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:tns="http://www.webserviceX.NET/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.webserviceX.NET/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/">
+ <s:element name="GetQuote">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+
+ </s:element>
+ <s:element name="GetQuoteResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="string" nillable="true" type="s:string" />
+
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetQuoteSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuote" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuoteResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetIn">
+
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetOut">
+ <wsdl:part name="Body" element="tns:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostIn">
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostOut">
+
+ <wsdl:part name="Body" element="tns:string" />
+ </wsdl:message>
+ <wsdl:portType name="StockQuoteSoap">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteSoapIn" />
+ <wsdl:output message="tns:GetQuoteSoapOut" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpGet">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpGetIn" />
+ <wsdl:output message="tns:GetQuoteHttpGetOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="StockQuoteHttpPost">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpPostIn" />
+ <wsdl:output message="tns:GetQuoteHttpPostOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap">
+
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="GetQuote">
+ <soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet">
+ <http:binding verb="GET" />
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:mimeXml part="Body" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost">
+ <http:binding verb="POST" />
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StockQuote">
+
+ <wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap">
+ <soap:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet">
+ <http:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost">
+ <http:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sandbox/old/contrib/itest/pom.xml.off b/sandbox/old/contrib/itest/pom.xml.off
new file mode 100644
index 0000000000..fd23410e10
--- /dev/null
+++ b/sandbox/old/contrib/itest/pom.xml.off
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>integration-test</artifactId>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Integration Tests</name>
+ <description>Integration tests for SCA.</description>
+
+ <modules>
+ <module>specTest</module>
+ <module>propertyTest</module>
+ </modules>
+
+ <properties>
+ <!-- version the SCA API that we implement -->
+ <scaSpecVersion>1.0</scaSpecVersion>
+
+ <!-- version the Apache Tuscany kernel that the runtimes work with -->
+ <kernelVersion>2.0-alpha-incubating</kernelVersion>
+ </properties>
+
+ <dependencies>
+ <!-- org.osoa.sca API -->
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>verify</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <version>${kernelVersion}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/itest/propertyTest/pom.xml.off b/sandbox/old/contrib/itest/propertyTest/pom.xml.off
new file mode 100644
index 0000000000..a8af8b28ea
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/pom.xml.off
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>integration-test</artifactId>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.integration-test</groupId>
+ <artifactId>propertyTest</artifactId>
+ <packaging>jar</packaging>
+ <name>Integration Test Suite for SCA Properties</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java
new file mode 100644
index 0000000000..7d7360f678
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponent.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+public interface ABComponent {
+
+ String getA();
+ String getB();
+ String getZ();
+ int getIntValue();
+ String getF();
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java
new file mode 100644
index 0000000000..dc45dbf035
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ABComponentImpl.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+import org.osoa.sca.annotations.Property;
+
+public class ABComponentImpl implements ABComponent {
+
+ private String aProperty;
+ private String bProperty;
+ private int intValue;
+ // private Collection manyProp;
+ private String zProperty;
+ private String fProperty;
+
+ @Property(name="xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+// @Property(name="foobar")
+// public void setCollectionProperty(final Collection value) {
+// this.manyProp = value;
+// }
+
+ @Property
+ public void setA(final String A) {
+ this.aProperty = A;
+ }
+
+ @Property
+ public void setB(final String B) {
+ this.bProperty = B;
+ }
+
+ @Property
+ public void setF(final String F) {
+ this.fProperty = F;
+ }
+
+ @Property
+ public void setOne(final int value) {
+ this.intValue = value;
+ }
+
+ public String getA() {
+ return this.aProperty;
+ }
+
+ public String getB() {
+ return this.bProperty;
+ }
+
+ public int getIntValue() {
+ return this.intValue;
+ }
+
+ public String getZ() {
+ return this.zProperty;
+ }
+
+ public String getF() {
+ return this.fProperty;
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java
new file mode 100644
index 0000000000..b2b776346e
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponent.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+public interface CDComponent {
+
+ String getC();
+ String getC2();
+ String getD();
+ String getNoSource();
+ String getFileProperty();
+ int getOverrideValue();
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java
new file mode 100644
index 0000000000..f1bf91ef8e
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/CDComponentImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+import org.osoa.sca.annotations.Property;
+
+public class CDComponentImpl implements CDComponent {
+
+ private String cProperty;
+ private String dProperty;
+ private String nosource;
+ private String fileProperty;
+ private int overrideNumber;
+ private String cProperty2;
+
+ @Property(name="nonFileProperty")
+ public void setC2(final String value) {
+ this.cProperty2 = value;
+ }
+ @Property(name="two")
+ public void setOverrideNumber(final int value) {
+ this.overrideNumber = value;
+ }
+
+ @Property(name="fileProperty")
+ public void setFileProp(final String value) {
+ this.fileProperty = value;
+ }
+ @Property
+ public void setC(final String C) {
+ this.cProperty = C;
+ }
+
+ @Property
+ public void setD(final String D) {
+ this.dProperty = D;
+ }
+
+ @Property
+ public void setNosource(final String value) {
+ this.nosource = value;
+ }
+
+ public String getFileProperty() {
+ return this.fileProperty;
+ }
+
+ public String getC() {
+ return this.cProperty;
+ }
+
+ public String getC2() {
+ return this.cProperty2;
+ }
+
+ public String getD() {
+ return this.dProperty;
+ }
+
+ public String getNoSource() {
+ return this.nosource;
+ }
+
+ public int getOverrideValue() {
+ return this.overrideNumber;
+ }
+}
+
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java
new file mode 100644
index 0000000000..c346b69c30
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/ComplexPropertyBean.java
@@ -0,0 +1,69 @@
+package org.apache.tuscany.sca.test.property;
+
+public class ComplexPropertyBean {
+
+ protected int integerNumber = 25;
+ public float floatNumber = 50;
+ public double doubleNumber = 75;
+ public int[] intArray = null;
+ public double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ public ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ public String toString() {
+ return Double.toString(integerNumber) + " - " +
+ Double.toString(floatNumber) + " - " +
+ Double.toString(doubleNumber) + " \n" +
+ ((intArray == null ) ? "no int array" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "no double array" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "no string array" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "no numberset array" : numberSetArray[0] + " - " + numberSetArray[1] + " \n " ) +
+ ((numberSet == null ) ? "" : numberSet.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java
new file mode 100644
index 0000000000..7516c61836
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideService.java
@@ -0,0 +1,25 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+public interface OverrideService {
+
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java
new file mode 100644
index 0000000000..f44263c3f4
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/OverrideServiceImpl.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java
new file mode 100644
index 0000000000..3a77c1fe2f
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponent.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+
+public interface PropertyComponent {
+ public String getLocation();
+ public String getYear();
+ public ComplexPropertyBean getComplexPropertyOne();
+ public ComplexPropertyBean getComplexPropertyTwo();
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java
new file mode 100644
index 0000000000..e2b331f693
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyComponentImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+import org.osoa.sca.annotations.Property;
+
+public class PropertyComponentImpl implements PropertyComponent {
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ public String getLocation(){
+ return location;
+ }
+
+ public String getYear(){
+ return year;
+ }
+
+ public ComplexPropertyBean getComplexPropertyOne() {
+ return complexPropertyOne;
+ }
+
+ public ComplexPropertyBean getComplexPropertyTwo() {
+ return complexPropertyTwo;
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java
new file mode 100644
index 0000000000..6110283c80
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/PropertyService.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+public interface PropertyService {
+
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java
new file mode 100644
index 0000000000..e21b31f90d
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ConstructorPrimitives.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Implementation where all primitive properties are passed in the constructor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstructorPrimitives implements PrimitiveService {
+ private boolean booleanValue;
+
+ private byte byteValue;
+
+ private short shortValue;
+
+ private int intValue;
+
+ private long longValue;
+
+ private float floatValue;
+
+ private double doubleValue;
+
+ public ConstructorPrimitives(@Property(name = "booleanValue") boolean booleanValue,
+ @Property(name = "byteValue") byte byteValue,
+ @Property(name = "shortValue") short shortValue,
+ @Property(name = "intValue") int intValue,
+ @Property(name = "longValue") long longValue,
+ @Property(name = "floatValue") float floatValue,
+ @Property(name = "doubleValue") double doubleValue) {
+ this.booleanValue = booleanValue;
+ this.byteValue = byteValue;
+ this.shortValue = shortValue;
+ this.intValue = intValue;
+ this.longValue = longValue;
+ this.floatValue = floatValue;
+ this.doubleValue = doubleValue;
+ }
+
+ public boolean isBooleanValue() {
+ return booleanValue;
+ }
+
+ public byte getByteValue() {
+ return byteValue;
+ }
+
+ public short getShortValue() {
+ return shortValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String getImplementationName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java
new file mode 100644
index 0000000000..1d599c70a3
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveService.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+/**
+ * Service interface for primitive property tests.
+ * This defines the methods and the values typically returned from a test.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PrimitiveService {
+ String getImplementationName();
+
+ boolean BOOLEAN_VALUE = true;
+
+ boolean isBooleanValue();
+
+ byte BYTE_VALUE = 123;
+
+ byte getByteValue();
+
+ short SHORT_VALUE = 12345;
+
+ short getShortValue();
+
+ int INT_VALUE = 12345678;
+
+ int getIntValue();
+
+ long LONG_VALUE = 9876543210L;
+
+ long getLongValue();
+
+ float FLOAT_VALUE = 1.234e12f;
+
+ float getFloatValue();
+
+ double DOUBLE_VALUE = 1.23456789e87;
+
+ double getDoubleValue();
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java
new file mode 100644
index 0000000000..c2cd13b831
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedFieldPrimitives.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+/**
+ * Implementation where all primitive properties are private fields.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProtectedFieldPrimitives implements PrimitiveService {
+ protected boolean booleanValue;
+
+ protected byte byteValue;
+
+ protected short shortValue;
+
+ protected int intValue;
+
+ protected long longValue;
+
+ protected float floatValue;
+
+ protected double doubleValue;
+
+ public boolean isBooleanValue() {
+ return booleanValue;
+ }
+
+ public byte getByteValue() {
+ return byteValue;
+ }
+
+ public short getShortValue() {
+ return shortValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String getImplementationName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java
new file mode 100644
index 0000000000..7cbb0c1371
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/ProtectedSetterPrimitives.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+/**
+ * Implementation where all primitive properties are passed in using protected setter methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProtectedSetterPrimitives implements PrimitiveService {
+ protected boolean booleanValue;
+
+ protected byte byteValue;
+
+ protected short shortValue;
+
+ protected int intValue;
+
+ protected long longValue;
+
+ protected float floatValue;
+
+ protected double doubleValue;
+
+ public void setBooleanValue(boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
+
+ public void setByteValue(byte byteValue) {
+ this.byteValue = byteValue;
+ }
+
+ public void setShortValue(short shortValue) {
+ this.shortValue = shortValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public void setLongValue(long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setFloatValue(float floatValue) {
+ this.floatValue = floatValue;
+ }
+
+ public void setDoubleValue(double doubleValue) {
+ this.doubleValue = doubleValue;
+ }
+
+ public boolean isBooleanValue() {
+ return booleanValue;
+ }
+
+ public byte getByteValue() {
+ return byteValue;
+ }
+
+ public short getShortValue() {
+ return shortValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String getImplementationName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java
new file mode 100644
index 0000000000..a38875b82a
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicFieldPrimitives.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+/**
+ * Implementation where all primitive properties are private fields.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PublicFieldPrimitives implements PrimitiveService {
+ public boolean booleanValue;
+
+ public byte byteValue;
+
+ public short shortValue;
+
+ public int intValue;
+
+ public long longValue;
+
+ public float floatValue;
+
+ public double doubleValue;
+
+ public boolean isBooleanValue() {
+ return booleanValue;
+ }
+
+ public byte getByteValue() {
+ return byteValue;
+ }
+
+ public short getShortValue() {
+ return shortValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String getImplementationName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java
new file mode 100644
index 0000000000..e7b527ba63
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/java/org/apache/tuscany/sca/test/property/primitives/PublicSetterPrimitives.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+/**
+ * Implementation where all primitive properties are passed in using public setter methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PublicSetterPrimitives implements PrimitiveService {
+ private boolean booleanValue;
+
+ private byte byteValue;
+
+ private short shortValue;
+
+ private int intValue;
+
+ private long longValue;
+
+ private float floatValue;
+
+ private double doubleValue;
+
+ public void setBooleanValue(boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
+
+ public void setByteValue(byte byteValue) {
+ this.byteValue = byteValue;
+ }
+
+ public void setShortValue(short shortValue) {
+ this.shortValue = shortValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public void setLongValue(long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setFloatValue(float floatValue) {
+ this.floatValue = floatValue;
+ }
+
+ public void setDoubleValue(double doubleValue) {
+ this.doubleValue = doubleValue;
+ }
+
+ public boolean isBooleanValue() {
+ return booleanValue;
+ }
+
+ public byte getByteValue() {
+ return byteValue;
+ }
+
+ public short getShortValue() {
+ return shortValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String getImplementationName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..9eb0b0f126
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="PropertyTestComposite">
+
+ <include name="PrimitivesTestComposite" scdlLocation="primitives.scdl"/>
+
+ <!--
+ <property name="number" type="xsd:int">1</property>
+
+ <property name="complex" type="foo:MyComplexType">
+ <foo:a>a</foo:a>
+ <foo:b>b</foo:b>
+ <foo:c>c</foo:c>
+ <foo:d>d</foo:d>
+ <foo:x>
+ <y>y</y>
+ <z>z</z>
+ </foo:x>
+ </property>
+
+ <property name="moreComplex" type="foo:MyMoreComplexType">
+ <foo:stringArray>TestString_1</foo:stringArray>
+ <foo:stringArray>TestString_2</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11</foo:floatNumber>
+ <foo:doubleNumber>111</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22</foo:floatNumber>
+ <foo:doubleNumber>222</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </property>
+
+ <component name="ABComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.property.ABComponentImpl"/>
+ <property name="a" source="$complex/foo:a"/>
+ <property name="b" source="$complex/foo:b"/>
+ <property name="f" source="$complex/foo:a">f</property>
+ <property name="xpath" source="$complex/foo:x/*[local-name()='z']"/>
+ <property name="one" source="$number"/>
+ </component>
+
+ <component name="CDComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.property.CDComponentImpl"/>
+ <property name="c" source="$complex/foo:c"/>
+ <property name="d" source="$complex/foo:d"/>
+ <property name="nosource">aValue</property>
+ <property name="fileProperty" file="META-INF/sca/fileProperty.txt"/>
+ <property name="nonFileProperty" file="META-INF/sca/fileProperty.txt" source="$complex/foo:c"/>
+ <property name="two" source="$number">2</property>
+ </component>
+
+ <component name="PropertyComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.property.PropertyComponentImpl"/>
+ <property name="complexPropertyOne" source="$moreComplex"></property>
+ <property name="complexPropertyTwo">
+ <foo:stringArray>TestString_1</foo:stringArray>
+ <foo:stringArray>TestString_2</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11</foo:floatNumber>
+ <foo:doubleNumber>111</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22</foo:floatNumber>
+ <foo:doubleNumber>222</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </property>
+ </component>
+-->
+</composite>
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt
new file mode 100644
index 0000000000..c530ae892d
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt
@@ -0,0 +1 @@
+<filePropertyTest>fileValue</filePropertyTest>
diff --git a/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl
new file mode 100644
index 0000000000..9a47ffc74b
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/main/resources/META-INF/sca/primitives.scdl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="PrimitivesTestComposite">
+
+ <component name='ConstructorPrimitives'>
+ <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ConstructorPrimitives'/>
+ <property name='booleanValue'>true</property>
+ <property name='byteValue'>123</property>
+ <property name='shortValue'>12345</property>
+ <property name='intValue'>12345678</property>
+ <property name='longValue'>9876543210</property>
+ <property name='floatValue'>1.234e12</property>
+ <property name='doubleValue'>1.23456789e87</property>
+ </component>
+
+ <component name='PublicFieldPrimitives'>
+ <implementation.java class='org.apache.tuscany.sca.test.property.primitives.PublicFieldPrimitives'/>
+ <property name='booleanValue'>true</property>
+ <property name='byteValue'>123</property>
+ <property name='shortValue'>12345</property>
+ <property name='intValue'>12345678</property>
+ <property name='longValue'>9876543210</property>
+ <property name='floatValue'>1.234e12</property>
+ <property name='doubleValue'>1.23456789e87</property>
+ </component>
+
+ <component name='ProtectedFieldPrimitives'>
+ <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ProtectedFieldPrimitives'/>
+ <property name='booleanValue'>true</property>
+ <property name='byteValue'>123</property>
+ <property name='shortValue'>12345</property>
+ <property name='intValue'>12345678</property>
+ <property name='longValue'>9876543210</property>
+ <property name='floatValue'>1.234e12</property>
+ <property name='doubleValue'>1.23456789e87</property>
+ </component>
+
+ <component name='PublicSetterPrimitives'>
+ <implementation.java class='org.apache.tuscany.sca.test.property.primitives.PublicSetterPrimitives'/>
+ <property name='booleanValue'>true</property>
+ <property name='byteValue'>123</property>
+ <property name='shortValue'>12345</property>
+ <property name='intValue'>12345678</property>
+ <property name='longValue'>9876543210</property>
+ <property name='floatValue'>1.234e12</property>
+ <property name='doubleValue'>1.23456789e87</property>
+ </component>
+
+ <component name='ProtectedSetterPrimitives'>
+ <implementation.java class='org.apache.tuscany.sca.test.property.primitives.ProtectedSetterPrimitives'/>
+ <property name='booleanValue'>true</property>
+ <property name='byteValue'>123</property>
+ <property name='shortValue'>12345</property>
+ <property name='intValue'>12345678</property>
+ <property name='longValue'>9876543210</property>
+ <property name='floatValue'>1.234e12</property>
+ <property name='doubleValue'>1.23456789e87</property>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java
new file mode 100644
index 0000000000..954fd456d7
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/PropertyTestComponent.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.property;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class PropertyTestComponent extends TestCase {
+ @Reference
+ public ABComponent abService;
+ @Reference
+ public CDComponent cdService;
+ @Reference
+ public PropertyComponent propertyService;
+
+
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ public void testComplexProperty() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
+ assertNotNull(propBean);
+ assertEquals("TestString_1", propBean.getStringArray()[0]);
+ assertEquals(2, propBean.numberSetArray[1].integerNumber);
+
+ propBean = propertyService.getComplexPropertyTwo();
+ assertNotNull(propBean);
+ assertEquals(10, propBean.intArray[0]);
+ assertEquals((float) 22, propBean.numberSetArray[1].floatNumber);
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java
new file mode 100644
index 0000000000..f26e1d341a
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/test/java/org/apache/tuscany/sca/test/property/primitives/PrimitiveTestComponent.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.property.primitives;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Property;
+import junit.framework.TestCase;
+
+/**
+ * Test component for checking primitive property values.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrimitiveTestComponent extends TestCase {
+ @Reference
+ public PrimitiveService primitives;
+
+ @Property
+ public String expectedImplementation;
+
+ public void testExpectedImplementation() {
+ assertEquals(expectedImplementation, primitives.getImplementationName());
+ }
+
+ public void testBoolean() {
+ assertEquals(PrimitiveService.BOOLEAN_VALUE, primitives.isBooleanValue());
+ }
+
+ public void testByte() {
+ assertEquals(PrimitiveService.BYTE_VALUE, primitives.getByteValue());
+ }
+
+ public void testShort() {
+ assertEquals(PrimitiveService.SHORT_VALUE, primitives.getShortValue());
+ }
+
+ public void testInt() {
+ assertEquals(PrimitiveService.INT_VALUE, primitives.getIntValue());
+ }
+
+ public void testLong() {
+ assertEquals(PrimitiveService.LONG_VALUE, primitives.getLongValue());
+ }
+
+ public void testFloat() {
+ assertEquals(PrimitiveService.FLOAT_VALUE, primitives.getFloatValue());
+ }
+
+ public void testDouble() {
+ assertEquals(PrimitiveService.DOUBLE_VALUE, primitives.getDoubleValue());
+ }
+}
diff --git a/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl b/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..cfc9c11351
--- /dev/null
+++ b/sandbox/old/contrib/itest/propertyTest/src/test/resources/itest.scdl
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="PropertyTestHarnessComposite">
+
+ <include name="PropertyTestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testConstructorPrimitives">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/>
+ <reference name="primitives" target="ConstructorPrimitives"/>
+ <property name='expectedImplementation'>ConstructorPrimitives</property>
+ </component>
+
+ <component name="testPublicFieldPrimitives">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/>
+ <reference name="primitives" target="PublicFieldPrimitives"/>
+ <property name='expectedImplementation'>PublicFieldPrimitives</property>
+ </component>
+
+ <component name="testProtectedFieldPrimitives">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/>
+ <reference name="primitives" target="ProtectedFieldPrimitives"/>
+ <property name='expectedImplementation'>ProtectedFieldPrimitives</property>
+ </component>
+
+ <component name="testPublicSetterPrimitives">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/>
+ <reference name="primitives" target="PublicSetterPrimitives"/>
+ <property name='expectedImplementation'>PublicSetterPrimitives</property>
+ </component>
+
+ <component name="testProtectedSetterPrimitives">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.primitives.PrimitiveTestComponent"/>
+ <reference name="primitives" target="ProtectedSetterPrimitives"/>
+ <property name='expectedImplementation'>ProtectedSetterPrimitives</property>
+ </component>
+
+ <!--
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.test.property.PropertyTestComponent"/>
+ <reference name="abService" target="ABComponent"/>
+ <reference name="cdService" target="CDComponent"/>
+ <reference name="abcdService" target="ABCDComponent"/>
+ <reference name="propertyService" target="PropertyComponent"/>
+ </component>
+-->
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/pom.xml b/sandbox/old/contrib/itest/spec-api/pom.xml
new file mode 100644
index 0000000000..fa0f618820
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-spec-api</artifactId>
+ <name>Apache Tuscany SCA Spec API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java
new file mode 100644
index 0000000000..ba9dd59c46
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+public interface BasicService {
+
+ int negate(int theInt);
+ int delegateNegate(int theInt);
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java
new file mode 100644
index 0000000000..0f46725adf
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+public interface MathService {
+
+ int negate(int theInt);
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
new file mode 100644
index 0000000000..7fe9fa4909
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
new file mode 100644
index 0000000000..a381fc62dc
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ //FIXME renaming method due to TUSCANY-1173. Original name getHolidays
+ String[] getHolidaysByYear(int year);
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
new file mode 100644
index 0000000000..fbb2161df3
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
new file mode 100644
index 0000000000..98490c4e3d
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ //FIXME renaming method due to TUSCANY-1173. Original name nextHoliday
+ Date nextHolidayByDate(Date date);
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
new file mode 100644
index 0000000000..6a4cfc1f79
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
new file mode 100644
index 0000000000..c2d107ef28
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+
+public interface SCAComponentService {
+ String getComponentName();
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java
new file mode 100644
index 0000000000..083307234a
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import org.apache.tuscany.sca.test.spec.BasicService;
+import org.apache.tuscany.sca.test.spec.MathService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(BasicService.class)
+public class BasicServiceImpl implements BasicService {
+
+ @Context
+ protected ComponentContext context;
+
+ //The reference anntation is used in lieu of a component type definition
+ //This makes the call to getService redundant since the reference is injected
+ //but it serves the purpose to demonstrate that getService is working.
+ @Reference
+ protected MathService mathServiceReference;
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+ public int delegateNegate(int theInt) {
+ mathServiceReference = context.getService(MathService.class, "mathServiceReference");
+ return mathServiceReference.negate(theInt);
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java
new file mode 100644
index 0000000000..d3dc1585fc
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import org.apache.tuscany.sca.test.spec.MathService;
+import org.osoa.sca.annotations.Service;
+
+@Service(MathService.class)
+public class MathServiceImpl implements MathService {
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
new file mode 100644
index 0000000000..5170c32cd2
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = false)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidaysByYear(new Integer(year).intValue());
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (int i = 0; i < myListServicesList.size(); i++) {
+ myService = myListServicesList.get(i);
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (int i = 0; i < myListServicesArray.length; i++) {
+ myService = myListServicesArray[i];
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
new file mode 100644
index 0000000000..b81c2c2120
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ private String componentName;
+
+ public MyServiceImpl() {
+ //System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHolidayByDate(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHolidayByDate(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (int j = 0; j < days.length; j++) {
+ d1 = new Date(days[j]);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidaysByYear(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ //System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ //System.out.println("Stop service..");
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..11767522d6
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ return myListServiceByYear.getHolidaysByYear(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public Date nextHolidayByDate(Date date) {
+ return myServiceByDate.nextHolidayByDate(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite
new file mode 100644
index 0000000000..d650c8ab42
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/BasicService.composite
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="BasicServiceComposite">
+
+ <component name="BasicServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.BasicServiceImpl"/>
+ <reference name="mathServiceReference" target="MathServiceComponent"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite
new file mode 100644
index 0000000000..7a5f05b552
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/CompositeTest.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace = "http://foo"
+ xmlns:foo="http://foo"
+ name="CompositeTest">
+
+ <include name="foo:myTotalService"></include>
+ <include name="foo:myListService"></include>
+ <include name="foo:mySimpleServiceInRecursive">foo:mySimpleServiceInRecursive</include>
+ <include name="foo:myServiceInRecursive">foo:myServiceInRecursive</include>
+ <include name="foo:mySimpleServiceInRecursive2">foo:mySimpleServiceInRecursive2</include>
+ <include name="foo:myTotalServiceInRecursive">foo:myTotalServiceInRecursive</include>
+ <include name="foo:myTotalServiceInRecursiveForReferenceOverride">foo:myTotalServiceInRecursiveForReferenceOverride</include>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite
new file mode 100644
index 0000000000..59f8fa6981
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/MathService.composite
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="MathServiceComposite">
+
+ <component name="MathServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite
new file mode 100644
index 0000000000..1f0cd97fb4
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myListService.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myListService">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <reference name="myListServiceList" target="MyNCService/MyListService"/>
+ <reference name="myListServiceArray" target="MyListServiceFor2006/MyListService"/>
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite
new file mode 100644
index 0000000000..518cb295f9
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInComposite.composite
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myServiceInComposite">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyListService" promote="MyServiceComponent/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyListServiceByYear" promote="MyServiceComponent/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceByDate" promote="MyServiceComponent/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite
new file mode 100644
index 0000000000..f9f7615ec5
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myServiceInRecursive.composite
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myServiceInRecursive">
+
+ <service name="MyServiceInRecursiveMyService" promote="MyServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService" promote="MyServiceInRecursive/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear" promote="MyServiceInRecursive/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate" promote="MyServiceInRecursive/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite name="foo:myServiceInComposite"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite
new file mode 100644
index 0000000000..b1ecaced45
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleService.composite
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleService">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite
new file mode 100644
index 0000000000..662d67612d
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleServiceInRecursive">
+
+ <service name="MySimpleService" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MySimpleServiceNo" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMay" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMust" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:mySimpleService"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite
new file mode 100644
index 0000000000..e059c5b46f
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="mySimpleServiceInRecursive2">
+
+ <service name="MySimpleService2Default" promote="MySimpleServiceInRecursiveComponent/MySimpleService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2No" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2May" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleService2Must" promote="MySimpleServiceInRecursiveComponent/MySimpleServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite name="foo:mySimpleServiceInRecursive"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite
new file mode 100644
index 0000000000..f9076f6811
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalService.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalService">
+
+ <include name="foo:myservice">foo:myservice</include>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyNCService/MyService"/>
+ <reference name="myListService" target="MyNCService/MyListService"/>
+ <reference name="myListServiceByYear" target="MyNCService/MyListServiceByYear"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite
new file mode 100644
index 0000000000..af41baf277
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInComposite">
+
+ <service name="MyTotalService" promote="MyTotalServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRef" promote="MyTotalServiceComponent/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef" promote="MyTotalServiceComponent/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRef" promote="MyTotalServiceComponent/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
new file mode 100644
index 0000000000..e802b469d0
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInCompositeForReferenceOverride">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceComponentNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"/>
+ <reference name="myListService"/>
+ <reference name="myListServiceByYear"/>
+ </component>
+
+ <reference name="MyServiceRefNo" promote="MyTotalServiceComponentNo/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" promote="MyTotalServiceComponentNo/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefNo" promote="MyTotalServiceComponentNo/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceComponentMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRefMay" promote="MyTotalServiceComponentMay/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" promote="MyTotalServiceComponentMay/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefMay" promote="MyTotalServiceComponentMay/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceComponentMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ </component>
+
+ <reference name="MyServiceRefMust" promote="MyTotalServiceComponentMust/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" promote="MyTotalServiceComponentMust/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <reference name="MyListServiceByYearRefMust" promote="MyTotalServiceComponentMust/myListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite
new file mode 100644
index 0000000000..a69c4cedd4
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInRecursive">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite name="foo:myServiceInComposite"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceInComposite/MyService"/>
+ <reference name="myListService" target="MyServiceInComposite/MyListService"/>
+ <reference name="myListServiceByYear" target="MyServiceInComposite/MyListServiceByYear"/>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService" promote="MyTotalServiceInCompositeWithRecursive">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService" promote="MyTotalServiceInCompositeWithComponentService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite name="foo:myTotalServiceInComposite"/>
+ <reference name="MyServiceRef" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyListServiceByYearRef" target="MyServiceInComposite/MyListServiceByYear"/>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite name="foo:myTotalServiceInComposite"/>
+ <reference name="MyServiceRef" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRef" target="MyServiceInComponent/MyListServiceByYear"/>
+ </component>
+
+ <component name="myTotalServiceInRecursive_MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
new file mode 100644
index 0000000000..26033aad9f
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myTotalServiceInRecursiveForReferenceOverride">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceForReferenceComponent/MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite name="foo:myTotalServiceInCompositeForReferenceOverride"/>
+ <reference name="MyServiceRefNo" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefNo" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefNo" target="MyServiceInComponent/MyListServiceByYear"/>
+ <reference name="MyServiceRefMay" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefMay" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefMay" target="MyServiceInComponent/MyListServiceByYear"/>
+ <reference name="MyServiceRefMust" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRefMust" target="MyServiceInComponent/MyListService"/>
+ <reference name="MyListServiceByYearRefMust" target="MyServiceInComponent/MyListServiceByYear"/>
+ </component>
+
+ <component name="myTotalServiceInRecursiveForReferenceOverride_MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite b/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite
new file mode 100644
index 0000000000..4b5972bcc1
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/main/resources/myservice.composite
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="myservice">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java
new file mode 100644
index 0000000000..3f64202f13
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ComponentContextTestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Test description: Locate a service and invoke a method.
+ */
+ @Test
+ public void simpleLocate() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ /**
+ * Test description: Locate a service that will then locate another service
+ * via a defined reference by means of:
+ * ComponentContext.getService(Class<B>businessInterface, String referenceName);
+ */
+ @Test
+ public void delegateViaDefinedReference() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.delegateNegate(99));
+ }
+
+ @Before
+ public void init() throws Exception {
+ domain = SCADomain.newInstance("http://localhost", "/", "BasicService.composite", "MathService.composite");
+ }
+
+ @After
+ public void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java
new file mode 100644
index 0000000000..6a96326fbf
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ComponentServiceReferenceListTestCaseFIXME extends TestCase {
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+
+ private SCADomain domain;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myListService = domain.getService(MyListService.class, "MyNewListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyNewListService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java
new file mode 100644
index 0000000000..b5c6a0d7b5
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ComponentServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService;
+ private SCADomain domain;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHolidayByDate(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyTotalService.class, "MyTotalService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java
new file mode 100644
index 0000000000..d136530412
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ComponentTestCase {
+ private static MyService myService;
+ private static MyServiceByDate myServiceByDate;
+ private static MyListService myListService;
+ private static MyListServiceByYear myListServiceByYear;
+ private static MyService myNCService;
+ private static MyListService myListServiceFor2006;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ @Test
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ @Test
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ @Test
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ @Test
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MyService");
+ myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceByDate");
+ myListService = domain.getService(MyListService.class, "MyListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyListServiceByYear");
+ myNCService = domain.getService(MyService.class, "MyNCService");
+ myListServiceFor2006 = domain.getService(MyListService.class, "MyListServiceFor2006");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java
new file mode 100644
index 0000000000..5e54b5dcfa
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+@SuppressWarnings("deprecation")
+public class CompositeOneService2LevelTestCaseFIXME extends TestCase {
+ private MyService myService;
+ private MyService myServiceDefault;
+ private MyService myServiceNo;
+ private MyService myServiceMay;
+ private MyService myServiceMust;
+
+ private SCADomain domain;
+
+ public void testPropertyFromComponent() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MySimpleServiceInRecursiveComponent");
+ myServiceDefault = domain.getService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = domain.getService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = domain.getService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = domain.getService(MyService.class, "MySimpleServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java
new file mode 100644
index 0000000000..c29e9e72b3
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeOneServiceTestCase extends TestCase {
+ private MyService myService;
+ private SCADomain domain;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MySimpleServiceInRecursive");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java
new file mode 100644
index 0000000000..eb846ddb71
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeServiceReferenceForRefOverrideTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private SCADomain domain;
+
+ public void testPropertyWithServiceFromReferenceNo() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceFromReferenceMay() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceFromReferenceMust() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromReferenceNo() {
+ System.out.println("nextHolday()" + myService1.nextHoliday());
+ System.out.println("nextHolday(Date)" + myService1.nextHolidayByDate(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService1 = domain.getService(MyTotalService.class, "MyTotalServiceNo");
+ myService2 = domain.getService(MyTotalService.class, "MyTotalServiceMay");
+ myService3 = domain.getService(MyTotalService.class, "MyTotalServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java
new file mode 100644
index 0000000000..60ee8b2011
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private MyTotalService myService4;
+ private MyTotalService myService5;
+ private SCADomain domain;
+
+ public void FIXMEtestPropertyWithServiceFromRecursive() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceInCompositeFromRecursive() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceInCompositeFromComponent() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void FIXMEtestServiceFromRecursive() {
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHolidayByDate(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHolidayByDate(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidaysByYear(2007)[0]);
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService1 = domain.getService(MyTotalService.class, "MyTotalServiceFromRecursive");
+ myService2 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursive");
+ myService3 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentService");
+ myService4 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursiveUseService");
+ myService5 =
+ domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentServiceUseService");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java
new file mode 100644
index 0000000000..d9c2a73f7e
--- /dev/null
+++ b/sandbox/old/contrib/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CompositeTestCase {
+ private static MyService myService;
+ private static MyServiceByDate myServiceByDate;
+ private static MyListService myListService;
+ private static MyListServiceByYear myListServiceByYear;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ @Test
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ @Test
+ public void testContext() {
+ // FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ * assertNotNull("Service component name is null",
+ * myService.getComponentName()); assertNotNull("service context is
+ * null", myService.getContext()); System.out.println("Service component
+ * name :" + myService.getComponentName()); System.out.println("service
+ * context :" + myService.getContext()); test(context);
+ */
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CompositeTest.composite");
+ myService = domain.getService(MyService.class, "MyServiceInRecursiveMyService");
+ myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceInRecursiveMyServiceByDate");
+ myListService = domain.getService(MyListService.class, "MyServiceInRecursiveMyListService");
+ myListServiceByYear = domain.getService(MyListServiceByYear.class,
+ "MyServiceInRecursiveMyListServiceByYear");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/pom.xml.off b/sandbox/old/contrib/itest/specTest/pom.xml.off
new file mode 100644
index 0000000000..66d1127a0f
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/pom.xml.off
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>integration-test</artifactId>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.integration-test</groupId>
+ <artifactId>specTest</artifactId>
+ <packaging>jar</packaging>
+ <name>Integration Test Suite for SCA Spec APIs</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java
new file mode 100644
index 0000000000..6e1b8dc612
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContextTester extends IdentityService {
+ /**
+ * Returns true if the ComponentContext was injected
+ * @return true if the ComponentContext was injected
+ */
+ boolean isContextInjected();
+
+ /**
+ * Looks up a reference with the supplied name and returns the identity of the referenced component.
+ * @param name the name of a reference
+ * @return the identity of the referenced component
+ */
+ String getServiceIdentity(String name);
+
+ /**
+ * Looks up a reference with the supplied name using a ServiceReference
+ * and returns the identity of the referenced component.
+ * @param name the name of a reference
+ * @return the identity of the referenced component
+ */
+ String getServiceReferenceIdentity(String name);
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java
new file mode 100644
index 0000000000..df6366dbef
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Component that tests ComponentContext functions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextTesterImpl implements ComponentContextTester {
+ @Context
+ public ComponentContext context;
+
+ @Reference
+ public IdentityService getServiceTest;
+
+ public boolean isContextInjected() {
+ return context != null;
+ }
+
+ public String getURI() {
+ return context.getURI();
+ }
+
+ public String getServiceIdentity(String name) {
+ IdentityService service = context.getService(IdentityService.class, name);
+ return service.getURI();
+ }
+
+ public String getServiceReferenceIdentity(String name) {
+ ServiceReference<IdentityService> ref = context.getServiceReference(IdentityService.class, name);
+ IdentityService service = ref.getService();
+ return service.getURI();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java
new file mode 100644
index 0000000000..cab690eafd
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IdentifiableComponent implements IdentityService {
+ @Context
+ public ComponentContext context;
+
+ public String getURI() {
+ return context.getURI();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java
new file mode 100644
index 0000000000..25435a3cc4
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface IdentityService {
+ String getURI();
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
new file mode 100644
index 0000000000..7fe9fa4909
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
new file mode 100644
index 0000000000..28a26dddde
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ String[] getHolidays(int year);
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
new file mode 100644
index 0000000000..fbb2161df3
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
new file mode 100644
index 0000000000..892b36e1a1
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ Date nextHoliday(Date date);
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
new file mode 100644
index 0000000000..6a4cfc1f79
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
new file mode 100644
index 0000000000..2ba1cb41cb
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.ComponentContext;
+
+public interface SCAComponentService {
+ String getComponentName();
+
+ ComponentContext getContext();
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
new file mode 100644
index 0000000000..6f3f761432
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = false)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidays(Integer.parseInt(year));
+ }
+
+ public String[] getHolidays(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (MyListService aMyListServicesList : myListServicesList) {
+ myService = aMyListServicesList;
+ if (Integer.parseInt(myService.getYear()) == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (MyListService aMyListServicesArray : myListServicesArray) {
+ myService = aMyListServicesArray;
+ if (Integer.parseInt(myService.getYear()) == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
new file mode 100644
index 0000000000..3aa2c2a136
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ protected String componentName;
+
+ @Context
+ protected ComponentContext context;
+
+ public MyServiceImpl() {
+ System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHoliday(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHoliday(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (String day : days) {
+ d1 = new Date(day);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidays(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidays(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ System.out.println("Stop service..");
+
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public ComponentContext getContext() {
+ return context;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..d56e9aede4
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidays(int year) {
+ return myListServiceByYear.getHolidays(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public ComponentContext getContext() {
+ return myService.getContext();
+ }
+
+ public Date nextHoliday(Date date) {
+ return myServiceByDate.nextHoliday(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..0f09f102b9
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpecTestComposite">
+
+ <component name="ComponentContextTester">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.ComponentContextTesterImpl"/>
+ <reference name="getServiceTest" target="ReferencedService"/>
+ </component>
+
+ <component name="ReferencedService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.IdentifiableComponent"/>
+ </component>
+
+ <!--
+ <include name="myTotalService" scdlLocation="myTotalService.scdl"/>
+ <include name="myListService" scdlLocation="myListService.scdl"/>
+ <include name="mySimpleServiceInRecursive" scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ <include name="myServiceInRecursive" scdlLocation="myServiceInRecursive.scdl"/>
+ <include name="mySimpleServiceInRecursive2" scdlLocation="mySimpleServiceInRecursive2.scdl"/>
+ <include name="MyTotalServiceInRecursive" scdlLocation="MyTotalServiceInRecursive.scdl"/>
+ <include name="MyTotalServiceInRecursiveForReferenceOverride" scdlLocation="MyTotalServiceInRecursiveForReferenceOverride.scdl"/>
+ -->
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl
new file mode 100644
index 0000000000..55293b00f1
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyListServiceTest">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <!--
+ <reference name="myListServiceList">MyNCService/MyListService</reference>
+ <reference name="myListServiceArray">MyListServiceFor2006/MyListService</reference>
+ -->
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl
new file mode 100644
index 0000000000..14b1261604
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceInCompositeTest">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MyListService" promote="MyServiceComponent/MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </service>
+
+
+ <service name="MyListServiceByYear" promote="MyServiceComponent/MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ </service>
+
+
+ <service name="MyServiceByDate" promote="MyServiceComponent/MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl
new file mode 100644
index 0000000000..5d13f75970
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceInRecursiveTest">
+
+ <service name="MyServiceInRecursiveMyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceInRecursive/MyListService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceInRecursive/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceInRecursive/MyServiceByDate</reference>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite scdlLocation="MyServiceInComposite.scdl"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl
new file mode 100644
index 0000000000..700ae21b25
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceTest">
+
+ <service name="MyService" promote="MyServiceComponent/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl
new file mode 100644
index 0000000000..1354fc2ba4
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleService" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+
+ <service name="MySimpleServiceNo" override="no" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must" promote="MySimpleServiceInRecursive/MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite scdlLocation="mySimpleService.scdl"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl
new file mode 100644
index 0000000000..79287745b7
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleServiceDefault">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleService</reference>
+ </service>
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceNo</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMay</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMust</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl
new file mode 100644
index 0000000000..8e676fedf8
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <include name="myservice" scdlLocation="myservice.scdl"/>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyNCService/MyService"/>
+ <reference name="myListService" target="MyNCService/MyListService"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl
new file mode 100644
index 0000000000..825e3777b6
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceReferenceOverrideTest">
+
+ <service name="MyTotalService" promote="MyTotalServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference target="MyTotalServiceComponent"/>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRef"/>
+ <reference name="myListService" target="MyListServiceRef"/>
+ </component>
+
+ <reference name="MyServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl
new file mode 100644
index 0000000000..29bfa3cd23
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentNo</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefNo"/>
+ <reference name="myListService" target="MyListServiceRefNo"/>
+ </component>
+
+ <reference name="MyServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMay</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefMay"/>
+ <reference name="myListService" target="MyListServiceRefMay"/>
+ </component>
+
+ <reference name="MyServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMust</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceRefMust"/>
+ <reference name="myListService" target="MyListServiceRefMust"/>
+ </component>
+
+ <reference name="MyServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl
new file mode 100644
index 0000000000..98c19b6116
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite scdlLocation="myServiceInComposite.scdl"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceInComposite/MyService"/>
+ <reference name="myListService">MyServiceInComposite/MyListService</reference>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService" promote="MyTotalServiceInCompositeWithRecursive">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService" promote="MyTotalServiceInCompositeWithComponentService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"/>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef" target="MyServiceInComponent/MyService"/>
+ <reference name="MyListServiceRef" target="MyServiceInComponent/MyListService"/>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl
new file mode 100644
index 0000000000..51cd181b00
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <service name="MyTotalServiceNo" promote="MyTotalServiceForReferenceComponent/MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMay" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <service name="MyTotalServiceMust" promote="MyTotalServiceForReferenceComponent/MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite scdlLocation="myTotalServiceInCompositeForReferenceOverride.scdl"/>
+ <reference name="MyServiceRefNo" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefNo" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyServiceRefMay" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefMay" target="MyServiceInComposite/MyListService"/>
+ <reference name="MyServiceRefMust" target="MyServiceInComposite/MyService"/>
+ <reference name="MyListServiceRefMust" target="MyServiceInComposite/MyListService"/>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl
new file mode 100644
index 0000000000..845cbbf9fd
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceComposite">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java
new file mode 100644
index 0000000000..c7bce6e65f
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextTestComponent extends TestCase {
+ @Reference
+ public ComponentContextTester tester;
+
+ public void testContextWasInjected() {
+ assertTrue(tester.isContextInjected());
+ }
+
+ public void testComponentURI() {
+ assertEquals("itest://localhost/testDomain/testHarness/ComponentContextTester", tester.getURI());
+ }
+
+ public void testGetService() {
+ assertEquals("itest://localhost/testDomain/testHarness/ReferencedService",
+ tester.getServiceIdentity("getServiceTest"));
+ }
+
+ public void testGetServiceReference() {
+ assertEquals("itest://localhost/testDomain/testHarness/ReferencedService",
+ tester.getServiceReferenceIdentity("getServiceTest"));
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java
new file mode 100644
index 0000000000..c06ce947ea
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class ComponentServiceReferenceListTest extends TestCase {
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2007)[0]);
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java
new file mode 100644
index 0000000000..30a4959d8f
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+
+public class ComponentServiceReferenceTest extends TestCase {
+ @Reference
+ public MyTotalService myService;
+
+ @Context
+ public ComponentContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHoliday(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidays(2007)[0]);
+
+ }
+
+ public void testMyServiceContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ }
+
+ public void testContext() {
+ assertNotNull("service context is null", context);
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java
new file mode 100644
index 0000000000..d039a066a7
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Reference;
+
+import junit.framework.TestCase;
+
+public class ComponentTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyServiceByDate myServiceByDate;
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+ @Reference
+ public MyService myNCService;
+ @Reference
+ public MyListService myListServiceFor2006;
+
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2006)[0]);
+
+ }
+
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidays(2006)[0]);
+
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java
new file mode 100644
index 0000000000..2a50cdc8df
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeOneService2LevelTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyService myServiceDefault;
+ @Reference
+ public MyService myServiceNo;
+ @Reference
+ public MyService myServiceMay;
+ @Reference
+ public MyService myServiceMust;
+
+ public void testPropertyFromComponent() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java
new file mode 100644
index 0000000000..27deb92012
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeOneServiceTest extends TestCase {
+ @Reference
+ public MyService myService;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
new file mode 100644
index 0000000000..b312fd1e36
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeServiceReferenceForRefOverrideTest extends TestCase {
+ @Reference
+ public MyTotalService myService1;
+ @Reference
+ public MyTotalService myService2;
+ @Reference
+ public MyTotalService myService3;
+
+ public void testPropertyWithServiceFromReferenceNo() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceFromReferenceMay() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceFromReferenceMust() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromReferenceNo() {
+ System.out.println("nextHolday()" + myService1.nextHoliday());
+ System.out.println("nextHolday(Date)" + myService1.nextHoliday(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidays(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidays(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidays(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidays(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new Date()));
+
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
new file mode 100644
index 0000000000..edf8d05512
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeServiceReferenceTest extends TestCase {
+ @Reference
+ public MyTotalService myService1;
+ @Reference
+ public MyTotalService myService2;
+ @Reference
+ public MyTotalService myService3;
+ @Reference
+ public MyTotalService myService4;
+ @Reference
+ public MyTotalService myService5;
+
+ public void testPropertyWithServiceFromRecursive() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceInCompositeFromRecursive() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceInCompositeFromComponent() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromRecursive() {
+ assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidays(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidays(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHoliday(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidays(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidays(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHoliday(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidays(2007)[0]);
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
new file mode 100644
index 0000000000..98c368fdba
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+public class CompositeTest extends TestCase {
+ @Reference
+ public MyService myService;
+ @Reference
+ public MyServiceByDate myServiceByDate;
+ @Reference
+ public MyListService myListService;
+ @Reference
+ public MyListServiceByYear myListServiceByYear;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2007)[0]);
+
+ }
+
+ public void testContext() {
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+ }
+}
diff --git a/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl b/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..62c5cece94
--- /dev/null
+++ b/sandbox/old/contrib/itest/specTest/src/test/resources/itest.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="SpecTestHarnessComposite">
+
+ <include name="SpecTestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponentContext">
+ <tuscany:junit class="org.apache.tuscany.sca.test.spec.ComponentContextTestComponent"/>
+ <reference name="tester" target="ComponentContextTester"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/jmx/DISCLAIMER b/sandbox/old/contrib/jmx/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/old/contrib/jmx/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/old/contrib/jmx/LICENSE b/sandbox/old/contrib/jmx/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sandbox/old/contrib/jmx/LICENSE
@@ -0,0 +1,205 @@
+
+ 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.
+
+
+
diff --git a/sandbox/old/contrib/jmx/NOTICE b/sandbox/old/contrib/jmx/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sandbox/old/contrib/jmx/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/jmx/pom.xml b/sandbox/old/contrib/jmx/pom.xml
new file mode 100644
index 0000000000..fb49a0dcc0
--- /dev/null
+++ b/sandbox/old/contrib/jmx/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>management</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services.management</groupId>
+ <artifactId>management-jmx</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JMX Management</name>
+ <description>Apache Tuscany JMX Management</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxException.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxException.java
new file mode 100644
index 0000000000..58e205189c
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Maps JMX exceptions to runtime exceptions.
+ *
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("serial")
+public class JmxException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the root cause.
+ * @param cause Initializes the root cause.
+ */
+ public JmxException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Initializes the root cause.
+ * @param message Message for the exception.
+ * @param cause Initializes the root cause.
+ */
+ public JmxException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxManagementService.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxManagementService.java
new file mode 100644
index 0000000000..2fa3675b4f
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/JmxManagementService.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.tuscany.service.management.jmx.instrument.InstrumentedComponent;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+
+/**
+ * JMX implementation of the management service.
+ *
+ * @version $Revision$ $Date$
+ */
+public class JmxManagementService implements TuscanyManagementService {
+
+ /**
+ * MBean server used by the JMX management service.
+ */
+ private final MBeanServer mBeanServer;
+
+ /**
+ * Management domain used by the runtime.
+ */
+ private final String managementDomain;
+
+
+ /**
+ * Constructor that initializes the MBeanServer and domain to use for registering components.
+ *
+ * @param mBeanServer the MBeanServer components should be registered with
+ * @param managementDomain the JMX domain to use when generating ObjectNames
+ */
+ public JmxManagementService(MBeanServer mBeanServer, String managementDomain) {
+ this.mBeanServer = mBeanServer;
+ this.managementDomain = managementDomain;
+ }
+
+ /**
+ * @throws JmxException In case of an unexpected JMX exception.
+ * @see org.apache.tuscany.spi.services.management.TuscanyManagementService#registerComponent(
+ *java.lang.String,org.apache.tuscany.spi.component.Component)
+ */
+ public final void registerComponent(String name, Component component) throws JmxException {
+
+ try {
+ name = name.replace(":", "-");
+ ObjectName on = new ObjectName(managementDomain + ":" + "type=component,name=" + name);
+ InstrumentedComponent mbean = new InstrumentedComponent(component);
+ mBeanServer.registerMBean(mbean, on);
+ } catch (JMException ex) {
+ throw new JmxException("Unable to register " + name, ex);
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/AbstractAgent.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/AbstractAgent.java
new file mode 100644
index 0000000000..0172b15d8c
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/AbstractAgent.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.agent;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * Abstract super class for all the agents.
+ * @version $Revison$ $Date$
+ *
+ */
+public abstract class AbstractAgent implements Agent {
+
+ /** Root domain */
+ private static final String DOMAIN = "tuscany";
+
+ /** MBean server to use. */
+ private MBeanServer mBeanServer;
+
+ /** Start flag. */
+ private AtomicBoolean started = new AtomicBoolean();
+
+ /** RMI connector adaptor. */
+ private JMXConnectorServer connectorServer;
+
+ /**
+ * Initialies the server.
+ * @throws ManagementException If unable to start the agent.
+ */
+ protected AbstractAgent() throws ManagementException {
+ mBeanServer = MBeanServerFactory.createMBeanServer(DOMAIN);
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.Agent#getMBeanServer()
+ */
+ public MBeanServer getMBeanServer() {
+ return mBeanServer;
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.Agent#register(java.lang.Object, java.lang.String)
+ */
+ public final void register(Object instance, String name) throws ManagementException {
+
+ try {
+ mBeanServer.registerMBean(instance, new ObjectName(name));
+ } catch (Exception ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.Agent#start()
+ */
+ public final void start() throws ManagementException {
+
+ try {
+
+ if(started.get()) {
+ throw new IllegalArgumentException("Agent already started");
+ }
+
+ preStart();
+
+ JMXServiceURL url = getAdaptorUrl();
+ connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mBeanServer);
+
+ connectorServer.start();
+
+ started.set(true);
+
+ } catch (MalformedURLException ex) {
+ throw new ManagementException(ex);
+ } catch (IOException ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.Agent#shutdown()
+ */
+ public final void shutdown() throws ManagementException {
+
+ try {
+
+ if(!started.get()) {
+ throw new IllegalArgumentException("Agent not started");
+ }
+
+ connectorServer.stop();
+ postStop();
+ started.set(false);
+
+ } catch (IOException ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+ /**
+ * Gets the underlying MBean server.
+ * @return A reference to the mbean server.
+ */
+ protected MBeanServer getMbeanServer() {
+ return mBeanServer;
+ }
+
+ /**
+ * Gets the adaptor URL.
+ * @return Adaptor URL.
+ */
+ protected abstract JMXServiceURL getAdaptorUrl();
+
+ /**
+ * Any initialiation required for protocol specific agent.
+ *
+ */
+ protected abstract void preStart();
+
+ /**
+ * Any initialiation required for protocol specific agent.
+ *
+ */
+ protected abstract void postStop();
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/Agent.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/Agent.java
new file mode 100644
index 0000000000..30727e21bf
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/Agent.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.agent;
+
+import javax.management.MBeanServer;
+
+/**
+ * Interface to a JMX agent.
+ * @version $Revision$ $Date$
+ *
+ */
+public interface Agent {
+
+ /**
+ * Registers a managed bean.
+ * @param instance Instance to be registered.
+ * @param name Object name of the instance.
+ * @throws ManagementException If unable to register the object.
+ */
+ void register(Object instance, String name) throws ManagementException;
+
+ /**
+ * Starts the JMX server.
+ * @throws ManagementException If unable to start the server.
+ */
+ void start() throws ManagementException;
+
+ /**
+ * Shuts down the JMX server.
+ * @throws ManagementException If unable to shutdown the server.
+ */
+ void shutdown() throws ManagementException;
+
+ /**
+ * Gets the MBean server used by the agent.
+ * @return MBean server used by the agent.
+ */
+ MBeanServer getMBeanServer();
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/ManagementException.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/ManagementException.java
new file mode 100644
index 0000000000..6ff8c14ac6
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/ManagementException.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.agent;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * @version $Revision$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class ManagementException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the root cause.
+ * @param th Root cause.
+ */
+ public ManagementException(Throwable th) {
+ super(th);
+ }
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/RmiAgent.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/RmiAgent.java
new file mode 100644
index 0000000000..f6fa58a77c
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/agent/RmiAgent.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.agent;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * Utility for starting the JMX server with an RMI agent.
+ *
+ * @version $Revsion$ $Date$
+ *
+ */
+public class RmiAgent extends AbstractAgent {
+
+ /** Administration port system property. */
+ private static final String ADMIN_PORT_PROPERTY = "tuscany.adminPort";
+
+ /** Default admin port. */
+ private static final int DEFAULT_ADMIN_PORT = 1099;
+
+ /** Instance */
+ private static final Agent INSTANCE = new RmiAgent();
+
+ /** RMI registry. */
+ private Registry registry;
+
+ /** Listen port */
+ private int port = DEFAULT_ADMIN_PORT;
+
+ /**
+ * Gets the adaptor URL.
+ * @return Adaptor URL used by the agent.
+ * @throws ManagementException If unable to start the agent.
+ */
+ protected JMXServiceURL getAdaptorUrl() throws ManagementException {
+
+ try {
+
+ String portValue = System.getProperty(ADMIN_PORT_PROPERTY);
+ if(portValue != null) {
+ port = Integer.parseInt(portValue);
+ }
+
+ // service:jmx:rmi:///jndi/rmi://localhost:1099/server
+ return new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/server");
+
+
+ } catch (MalformedURLException ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+ /**
+ * Returns the singleton agent instance.
+ * @return Agent instance.
+ * @throws ManagementException If unable to start the agent.
+ */
+ public static Agent getInstance() throws ManagementException {
+ return INSTANCE;
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.AbstractAgent#preStart()
+ */
+ @Override
+ public void preStart() throws ManagementException {
+
+ try {
+
+ String portValue = System.getProperty(ADMIN_PORT_PROPERTY);
+ if(portValue != null) {
+ port = Integer.parseInt(portValue);
+ }
+
+ registry = LocateRegistry.createRegistry(port);
+ } catch (RemoteException ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.service.management.jmx.agent.AbstractAgent#postStop()
+ */
+ @Override
+ public void postStop() throws ManagementException {
+
+ try {
+ UnicastRemoteObject.unexportObject(registry, true);
+ } catch (IOException ex) {
+ throw new ManagementException(ex);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/AnnotationDrivenDynamicMBean.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/AnnotationDrivenDynamicMBean.java
new file mode 100644
index 0000000000..3d16ff6a2a
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/AnnotationDrivenDynamicMBean.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.instrument;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.ReflectionException;
+
+/**
+ * Dynamic MBean based on management annotations.
+ *
+ * @version $Revision$ $Date$
+ */
+public class AnnotationDrivenDynamicMBean implements DynamicMBean {
+
+ /**
+ * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String attribute)
+ throws AttributeNotFoundException, MBeanException, ReflectionException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
+ */
+ public AttributeList getAttributes(String[] attributes) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getMBeanInfo()
+ */
+ public MBeanInfo getMBeanInfo() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#invoke(java.lang.String,java.lang.Object[],java.lang.String[])
+ */
+ public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException,
+ ReflectionException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
+ */
+ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
+ MBeanException, ReflectionException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
+ */
+ public AttributeList setAttributes(AttributeList attributes) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentationException.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentationException.java
new file mode 100644
index 0000000000..a8ad1666d5
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentationException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.instrument;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Excpetion thrown when there is an instrumentation error.
+ *
+ * @version $Revison$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class InstrumentationException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the root cause.
+ * @param cause Initializes the root cause.
+ */
+ public InstrumentationException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Initializes the message.
+ * @param message Initializes the message.
+ */
+ public InstrumentationException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentedComponent.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentedComponent.java
new file mode 100644
index 0000000000..9e0f06ec13
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/InstrumentedComponent.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.instrument;
+
+import java.util.Map;
+import java.net.URI;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanConstructorInfo;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanOperationInfo;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+/**
+ * This is Ruscany component exposed as a dynamic MBean. Currently it only supports a read-only vew of all the
+ * properties on the component.
+ *
+ * @version $Revision$ $Date$
+ */
+public class InstrumentedComponent implements DynamicMBean {
+
+ /**
+ * Properties available on the component.
+ */
+ private final Map<String, PropertyValue<?>> properties;
+
+ /**
+ * Name of the component.
+ */
+ private URI componentId;
+
+ /**
+ * Initializes the property values.
+ *
+ * @param component Component that is being managed.
+ */
+ @SuppressWarnings("unchecked")
+ public InstrumentedComponent(final Component component) {
+ this.properties = component.getDefaultPropertyValues();
+ this.componentId = component.getUri();
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
+ */
+ public final Object getAttribute(final String attribute) throws AttributeNotFoundException {
+ PropertyValue<?> propertyValue = properties.get(attribute);
+ if (propertyValue != null) {
+ return propertyValue.getValueFactory().getInstance();
+ }
+ throw new AttributeNotFoundException(attribute + " not found.");
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
+ */
+ public final AttributeList getAttributes(final String[] attributes) {
+
+ AttributeList list = new AttributeList();
+ for (String attribute : attributes) {
+ try {
+ list.add(new Attribute(attribute, getAttribute(attribute)));
+ } catch (AttributeNotFoundException ex) {
+ throw new InstrumentationException(ex);
+ }
+ }
+ return list;
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getMBeanInfo()
+ */
+ public final MBeanInfo getMBeanInfo() {
+
+ final MBeanConstructorInfo[] constructors = null;
+ final MBeanOperationInfo[] operations = null;
+ final MBeanNotificationInfo[] notifications = null;
+
+ int size = properties != null ? properties.size() : 0;
+ final MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[size];
+
+ if(properties != null) {
+ int i = 0;
+ for (PropertyValue<?> propertyValue : properties.values()) {
+ attributes[i++] =
+ new MBeanAttributeInfo(propertyValue.getName(), String.class.getName(), null, true, false, false);
+ }
+ }
+
+ return new MBeanInfo(componentId.toString(), null, attributes, constructors, operations, notifications);
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#invoke(java.lang.String,java.lang.Object[],java.lang.String[])
+ */
+ public final Object invoke(final String actionName, final Object[] params, final String[] signature) {
+ throw new UnsupportedOperationException("Managed ops not supported");
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
+ */
+ public final void setAttribute(final Attribute attribute) {
+ throw new UnsupportedOperationException("Mutable props not supported");
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
+ */
+ public final AttributeList setAttributes(final AttributeList attributes) {
+ throw new UnsupportedOperationException("Mutable props not supported");
+ }
+
+}
diff --git a/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/ReflectedDynamicMBean.java b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/ReflectedDynamicMBean.java
new file mode 100644
index 0000000000..b07787208c
--- /dev/null
+++ b/sandbox/old/contrib/jmx/src/main/java/org/apache/tuscany/service/management/jmx/instrument/ReflectedDynamicMBean.java
@@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.management.jmx.instrument;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.ReflectionException;
+
+/**
+ * Uses JMX dynamic MBean to expose management information of a delegate instance using reflection. Currently
+ * constructor and notification metadata are not supported. Any attribute or operation that needs to be excluded from
+ * the management information can be specified optionally in the factory method.
+ * <p/>
+ * All the methods and properties on <code>java.lang.Object</code> are excluded by default. Also only public and
+ * non-static members are made available for management.
+ * <p/>
+ * TODO Find a homw other than server.start for this class. TODO Tidy up, unit tests
+ *
+ * @version $Revsion$ $Date$
+ */
+public class ReflectedDynamicMBean implements DynamicMBean {
+
+ /**
+ * Excluded methods.
+ */
+ private static final List<String> DEFAULT_EXCLUDED_METHODS =
+ Arrays.asList(new String[]{"wait", "toString", "hashCode", "notify", "equals", "notifyAll", "getClass"});
+
+ /**
+ * Excluded properties.
+ */
+ private static final List<String> DEFAULT_EXCLUDED_PROPERTIES = Arrays.asList(new String[]{"class"});
+
+ /**
+ * Proxied object that is managed.
+ */
+ private Object delegate;
+
+ /**
+ * Runtime type of the managed object.
+ */
+ private Class delegateClass;
+
+ /**
+ * Delegate class name.
+ */
+ private String delegateClassName;
+
+ /**
+ * Cache of property write methods.
+ */
+ private Map<String, Method> propertyWriteMethods = new HashMap<String, Method>();
+
+ /**
+ * Cache of property read methods.
+ */
+ private Map<String, Method> propertyReadMethods = new HashMap<String, Method>();
+
+ /**
+ * Managed operation cache.
+ */
+ private Map<String, Method> methods = new HashMap<String, Method>();
+
+ /**
+ * Property descriptor cache.
+ */
+ private Map<String, PropertyDescriptor> properties = new HashMap<String, PropertyDescriptor>();
+
+ /**
+ * Excluded methods.
+ */
+ private final List<String> excludedMethods = new ArrayList<String>();
+
+ /**
+ * Excluded properties.
+ */
+ private final List<String> excludedProperties = new ArrayList<String>();
+
+ /**
+ * Introspects the bean and populate meta information.
+ *
+ * @param delegate Proxied managed instance.
+ */
+ private ReflectedDynamicMBean(Object delegate) {
+ this(delegate, new ArrayList<String>(), new ArrayList<String>());
+ }
+
+ /**
+ * Introspects the bean and populate meta information.
+ *
+ * @param delegate Proxied managed instance.
+ * @param excludedMethods Operations excluded from managed view.
+ * @param excludedProperties Properties excluded from managed view.
+ */
+ private ReflectedDynamicMBean(Object delegate, List<String> excludedMethods, List<String> excludedProperties) {
+
+ this.delegate = delegate;
+ this.delegateClass = delegate.getClass();
+ this.delegateClassName = delegateClass.getName();
+
+ this.excludedMethods.addAll(excludedMethods);
+ this.excludedMethods.addAll(DEFAULT_EXCLUDED_METHODS);
+ this.excludedProperties.addAll(excludedProperties);
+ this.excludedProperties.addAll(DEFAULT_EXCLUDED_PROPERTIES);
+
+ BeanInfo beanInfo;
+ try {
+ beanInfo = Introspector.getBeanInfo(delegateClass);
+ } catch (IntrospectionException ex) {
+ throw new InstrumentationException(ex);
+ }
+
+ cacheProperties(beanInfo);
+
+ cacheMethods(beanInfo);
+ }
+
+ /**
+ * Factory method for creating the management view.
+ *
+ * @param delegate Proxied managed instance.
+ * @param excludedMethods Operations excluded from managed view.
+ * @param excludedProperties Properties excluded from managed view.
+ * @return Proxy for the managed instance.
+ */
+ public static ReflectedDynamicMBean newInstance(Object delegate, List<String> excludedMethods,
+ List<String> excludedProperties) {
+ return new ReflectedDynamicMBean(delegate, excludedMethods, excludedProperties);
+ }
+
+ /**
+ * Factory method for creating the management view.
+ *
+ * @param delegate Proxied managed instance.
+ * @return Proxy for the managed instance.
+ */
+ public static ReflectedDynamicMBean newInstance(Object delegate) {
+ return new ReflectedDynamicMBean(delegate);
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String attribute)
+ throws AttributeNotFoundException, MBeanException, ReflectionException {
+
+ Method readMethod = propertyReadMethods.get(attribute);
+ if (readMethod == null) {
+ throw new AttributeNotFoundException(attribute + " not found");
+ }
+ try {
+ return readMethod.invoke(delegate);
+ } catch (IllegalAccessException ex) {
+ throw new ReflectionException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new ReflectionException(ex);
+ }
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
+ */
+ public AttributeList getAttributes(String[] attributes) {
+
+ AttributeList list = new AttributeList();
+ for (String attribute : attributes) {
+ try {
+ list.add(new Attribute(attribute, getAttribute(attribute)));
+ } catch (AttributeNotFoundException ex) {
+ throw new InstrumentationException(ex);
+ } catch (MBeanException ex) {
+ throw new InstrumentationException(ex);
+ } catch (ReflectionException ex) {
+ throw new InstrumentationException(ex);
+ }
+ }
+ return list;
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#getMBeanInfo()
+ */
+ public MBeanInfo getMBeanInfo() {
+
+ try {
+
+ MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[properties.keySet().size()];
+ int count = 0;
+ for (String property : properties.keySet()) {
+ Method readMethod = propertyReadMethods.get(property);
+ Method writeMethod = propertyWriteMethods.get(property);
+ attrs[count++] = new MBeanAttributeInfo(property, "", readMethod, writeMethod);
+ }
+
+ MBeanOperationInfo[] ops = new MBeanOperationInfo[methods.keySet().size()];
+ count = 0;
+ for (Method method : methods.values()) {
+ ops[count++] = new MBeanOperationInfo("", method);
+ }
+
+ MBeanInfo mBeanInfo = new MBeanInfo(delegateClassName, "", attrs, null, ops, null);
+ return mBeanInfo;
+
+ } catch (javax.management.IntrospectionException ex) {
+ throw new InstrumentationException(ex);
+ }
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#invoke(java.lang.String,java.lang.Object[],java.lang.String[])
+ */
+ public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException,
+ ReflectionException {
+
+ Method method = methods.get(actionName);
+ if (method == null) {
+ throw new InstrumentationException("Operation not found: " + actionName);
+ }
+ try {
+ return method.invoke(delegate, params);
+ } catch (IllegalAccessException ex) {
+ throw new ReflectionException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new ReflectionException(ex);
+ }
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
+ */
+ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
+ MBeanException, ReflectionException {
+
+ Method writeMethod = propertyWriteMethods.get(attribute.getName());
+ if (writeMethod == null) {
+ throw new AttributeNotFoundException(attribute + " not found");
+ }
+ try {
+ writeMethod.invoke(delegate, attribute.getValue());
+ } catch (IllegalAccessException ex) {
+ throw new ReflectionException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new ReflectionException(ex);
+ }
+
+ }
+
+ /**
+ * @see javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
+ */
+ public AttributeList setAttributes(AttributeList attributes) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Caches managed operations.
+ *
+ * @param beanInfo Bean info for the managed instance.
+ */
+ private void cacheMethods(BeanInfo beanInfo) {
+
+ for (MethodDescriptor methodDescriptor : beanInfo.getMethodDescriptors()) {
+
+ Method method = methodDescriptor.getMethod();
+ String name = method.getName();
+
+ if (excludedMethods.contains(name)) {
+ continue;
+ }
+ int modifiers = method.getModifiers();
+ if (!Modifier.isPublic(modifiers) || Modifier.isStatic(modifiers)) {
+ continue;
+ }
+ if (propertyReadMethods.values().contains(method) || propertyWriteMethods.values().contains(method)) {
+ continue;
+ }
+
+ // TODO Add support for overloaded methods
+ methods.put(name, method);
+
+ }
+
+ }
+
+ /**
+ * Caches managed properties.
+ *
+ * @param beanInfo Bean info for the managed instance.
+ */
+ private void cacheProperties(BeanInfo beanInfo) {
+ for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
+
+ String name = propertyDescriptor.getName();
+
+ if (excludedProperties.contains(name)) {
+ continue;
+ }
+ properties.put(name, propertyDescriptor);
+
+ Method readMethod = propertyDescriptor.getReadMethod();
+ if (readMethod != null && Modifier.isPublic(readMethod.getModifiers())) {
+ propertyReadMethods.put(name, readMethod);
+ }
+
+ Method writeMethod = propertyDescriptor.getWriteMethod();
+ if (writeMethod != null && Modifier.isPublic(writeMethod.getModifiers())) {
+ propertyWriteMethods.put(name, writeMethod);
+ }
+
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/management-console/LICENSE.txt b/sandbox/old/contrib/management-console/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/management-console/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/management-console/NOTICE.txt b/sandbox/old/contrib/management-console/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/management-console/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/management-console/pom.xml.off b/sandbox/old/contrib/management-console/pom.xml.off
new file mode 100644
index 0000000000..ad9d0ee7af
--- /dev/null
+++ b/sandbox/old/contrib/management-console/pom.xml.off
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-console</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ <!-- TODO Change this later to WAR, one we have war deployment on servlet host -->
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Console</name>
+ <description>An Apache Maven plugin for packaging SCA composite archives.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionForm.java b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionForm.java
new file mode 100644
index 0000000000..5a96f7267c
--- /dev/null
+++ b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionForm.java
@@ -0,0 +1,49 @@
+package org.apache.tuscany.sca.console.handler.scdl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.spi.host.ServletHost;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+@SuppressWarnings("serial")
+public class ScdlContributionForm extends TuscanyServlet {
+
+ /**
+ * Injects the servlet host and path mapping.
+ *
+ * @param servletHost Servlet host to use.
+ * @param path Path mapping for the servlet.
+ */
+ public ScdlContributionForm(@Reference(name = "servletHost") ServletHost servletHost,
+ @Property(name = "path") String path) {
+ super(servletHost, path);
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException Servlet exception.
+ * @throws IOException IO Exception.
+ */
+ protected void process(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+
+ PrintWriter writer = res.getWriter();
+ writer.println("<form name='' method='post' action='scdlSubmit'>");
+ writer.println("<textarea name='scdl' cols='60' rows='40'></textarea>");
+ writer.println("<br/>");
+ writer.println("<input type='submit' value='Contribute SCDL'/>");
+ writer.println("</form>");
+ writer.flush();
+ writer.close();
+
+ }
+
+}
diff --git a/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionHandler.java b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionHandler.java
new file mode 100644
index 0000000000..609187d668
--- /dev/null
+++ b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/ScdlContributionHandler.java
@@ -0,0 +1,64 @@
+package org.apache.tuscany.sca.console.handler.scdl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.host.deployment.AssemblyService;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+@SuppressWarnings("serial")
+public class ScdlContributionHandler extends TuscanyServlet {
+
+ // SCDL query parameter
+ private static final String SCDL_PARAM = "scdl";
+
+ // Assembly service to use
+ private AssemblyService assemblyService;
+
+ /**
+ * Injects the servlet host and path mapping.
+ *
+ * @param servletHost Servlet host to use.
+ * @param path Path mapping for the servlet.
+ */
+ public ScdlContributionHandler(@Reference(name = "servletHost") ServletHost servletHost,
+ @Property(name = "path") String path,
+ @Reference(name = "assemblyService") AssemblyService assemblyService) {
+ super(servletHost, path);
+ this.assemblyService = assemblyService;
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException Servlet exception.
+ * @throws IOException IO Exception.
+ */
+ protected void process(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+
+ try {
+ String scdl = req.getParameter(SCDL_PARAM);
+ InputStream in = new ByteArrayInputStream(scdl.getBytes());
+ assemblyService.include(in);
+ PrintWriter writer = res.getWriter();
+ writer.println("Processed SCDL ");
+ writer.flush();
+ writer.close();
+ } catch(DeploymentException ex) {
+ throw new ServletException(ex);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/TuscanyServlet.java b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/TuscanyServlet.java
new file mode 100644
index 0000000000..f614a2b33d
--- /dev/null
+++ b/sandbox/old/contrib/management-console/src/main/java/org/apache/tuscany/sca/console/handler/scdl/TuscanyServlet.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.console.handler.scdl;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.spi.host.ServletHost;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * Super class for all the Tuscany servlets.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+@EagerInit
+public abstract class TuscanyServlet extends HttpServlet {
+
+ /**
+ * Injects the servlet host and path mapping.
+ *
+ * @param servletHost Servlet host to use.
+ * @param path Path mapping for the servlet.
+ */
+ public TuscanyServlet(ServletHost servletHost, String path) {
+ servletHost.registerMapping(path, this);
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException Servlet exception.
+ * @throws IOException IO Exception.
+ */
+ protected abstract void process(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException;
+
+ /**
+ * Handles get requests.
+ */
+ @Override
+ protected final void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+ /**
+ * Handles post request.
+ */
+ @Override
+ protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+}
diff --git a/sandbox/old/contrib/management-console/src/main/resources/org/apache/tuscany/console/console.scdl b/sandbox/old/contrib/management-console/src/main/resources/org/apache/tuscany/console/console.scdl
new file mode 100644
index 0000000000..0d021f905c
--- /dev/null
+++ b/sandbox/old/contrib/management-console/src/main/resources/org/apache/tuscany/console/console.scdl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Servlets for the SCA console.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.sca.console"
+ autowire="true">
+
+ <!-- Servlet that serves the SCDL contribution form -->
+ <component name="console.scdlRequestForm">
+ <system:implementation.system class="org.apache.tuscany.sca.console.handler.scdl.ScdlContributionForm"/>
+ <property name="path">/scdlForm</property>
+ <reference name="servletHost" target="httpService"/>
+ </component>
+
+ <!-- Servlet that handles the scdl submission -->
+ <component name="console.scdlHandler">
+ <system:implementation.system class="org.apache.tuscany.sca.console.handler.scdl.ScdlContributionHandler"/>
+ <property name="path">/scdlSubmit</property>
+ <reference name="servletHost" target="httpService"/>
+ <reference name="assemblyService" target="assemblyService"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/maven-composite-plugin/LICENSE.txt b/sandbox/old/contrib/maven-composite-plugin/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/maven-composite-plugin/NOTICE.txt b/sandbox/old/contrib/maven-composite-plugin/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/maven-composite-plugin/pom.xml.off b/sandbox/old/contrib/maven-composite-plugin/pom.xml.off
new file mode 100644
index 0000000000..56d31cb480
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/pom.xml.off
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-composite-plugin</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Composite Plugin</name>
+ <description>An Apache Maven plugin for packaging SCA composite archives.</description>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <url>scp://people.apache.org/www/incubator.apache.org/tuscany/plugins/tuscany-composite-plugin</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <goalPrefix>tuscany</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <defaultGoal>verify</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/sandbox/old/contrib/maven-composite-plugin/src/main/java/org/apache/tuscany/sca/plugin/composite/CompositeMojo.java b/sandbox/old/contrib/maven-composite-plugin/src/main/java/org/apache/tuscany/sca/plugin/composite/CompositeMojo.java
new file mode 100644
index 0000000000..96a1e39399
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/src/main/java/org/apache/tuscany/sca/plugin/composite/CompositeMojo.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.composite;
+
+import java.io.File;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+
+/**
+ * Packages an SCA Composite archive.
+ *
+ * @version $Rev$ $Date$
+ * @goal composite
+ * @phase package
+ */
+public class CompositeMojo extends AbstractMojo {
+ private static final String[] DEFAULT_EXCLUDES = new String[]{"**/package.html"};
+
+ private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
+
+ /**
+ * Build output directory.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ protected File outputDirectory;
+
+ /**
+ * Name of the generated composite archive.
+ *
+ * @parameter expression="${project.build.finalName}"
+ */
+ protected String compositeName;
+
+ /**
+ * Classifier to add to the generated artifact.
+ *
+ * @parameter
+ */
+ protected String classifier;
+
+ /**
+ * Directory containing the classes to include in the archive.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ */
+ protected File classesDirectory;
+
+ /**
+ * Standard Maven archive configuration.
+ *
+ * @parameter
+ */
+ protected MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+ /**
+ * The Jar archiver.
+ *
+ * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+ * @required
+ * @readonly
+ */
+ protected JarArchiver jarArchiver;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * @component
+ * @required
+ * @readonly
+ */
+ protected MavenProjectHelper projectHelper;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ File composite = createArchive();
+
+ if (classifier != null) {
+ projectHelper.attachArtifact(project, "composite", classifier, composite);
+ } else {
+ project.getArtifact().setFile(composite);
+ }
+ }
+
+ protected File createArchive() throws MojoExecutionException {
+ File composite = getJarFile(outputDirectory, compositeName, classifier);
+
+ MavenArchiver archiver = new MavenArchiver();
+ archiver.setArchiver(jarArchiver);
+ archiver.setOutputFile(composite);
+ archive.setForced(true);
+
+ try {
+ File contentDirectory = classesDirectory;
+ if (!contentDirectory.exists()) {
+ getLog().warn("JAR will be empty - no content was marked for inclusion!");
+ } else {
+ archiver.getArchiver().addDirectory(contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES);
+ }
+
+ archiver.createArchive(project, archive);
+
+ return composite;
+ }
+ catch (Exception e) {
+ throw new MojoExecutionException("Error assembling composite", e);
+ }
+ }
+
+ protected File getJarFile(File buildDir, String finalName, String classifier) {
+ if (classifier != null) {
+ classifier = classifier.trim();
+ if (classifier.length() > 0) {
+ finalName = finalName + '-' + classifier;
+ }
+ }
+ return new File(buildDir, finalName + ".composite");
+ }
+}
diff --git a/sandbox/old/contrib/maven-composite-plugin/src/main/resources/META-INF/plexus/components.xml b/sandbox/old/contrib/maven-composite-plugin/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000000..81fd42b6ee
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>composite</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+ <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+ <package>org.apache.tuscany:tuscany-composite-plugin:composite</package>
+ <integration-test>org.apache.tuscany:tuscany-itest-plugin:test</integration-test>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+ </components>
+</component-set> \ No newline at end of file
diff --git a/sandbox/old/contrib/maven-composite-plugin/src/site/apt/usage.apt b/sandbox/old/contrib/maven-composite-plugin/src/site/apt/usage.apt
new file mode 100644
index 0000000000..f36dd63c5b
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/src/site/apt/usage.apt
@@ -0,0 +1,41 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+Usage
+
+ The <<<tuscany-composite-plugin>>> can be used to package and integration-test an SCA composite.
+ It is associated with artifacts with a type of <<<composite>>> and is activated by including
+ it in the <<<build>>> section of your pom:
+
++---+
+ <packaging>composite</packaging>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-composite-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
++---+
+
+ The build lifecycle for the project is the same as for normal Java jar artifacts with default
+ support for compiling Java code, processing resources, building and running unit tests.
+ The plugin also associates the {{{../tuscany-itest-plugin/index.html}<<<tuscany-itest-plugin>>>}} with the
+ integration-test phase of the build for testing the composite itself. \ No newline at end of file
diff --git a/sandbox/old/contrib/maven-composite-plugin/src/site/site.xml b/sandbox/old/contrib/maven-composite-plugin/src/site/site.xml
new file mode 100644
index 0000000000..caa04a13fe
--- /dev/null
+++ b/sandbox/old/contrib/maven-composite-plugin/src/site/site.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+<!--
+ <item name="FAQ" href="faq.html"/>
+-->
+ </menu>
+<!--
+ <menu name="Examples">
+ </menu>
+-->
+ </body>
+</project>
diff --git a/sandbox/old/contrib/maven-standalone-plugin/LICENSE.txt b/sandbox/old/contrib/maven-standalone-plugin/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/maven-standalone-plugin/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/maven-standalone-plugin/NOTICE.txt b/sandbox/old/contrib/maven-standalone-plugin/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/maven-standalone-plugin/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/maven-standalone-plugin/pom.xml.off b/sandbox/old/contrib/maven-standalone-plugin/pom.xml.off
new file mode 100644
index 0000000000..19c16ab527
--- /dev/null
+++ b/sandbox/old/contrib/maven-standalone-plugin/pom.xml.off
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-standalone-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Standalone Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.4</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/Dependency.java b/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/Dependency.java
new file mode 100644
index 0000000000..331a0bf287
--- /dev/null
+++ b/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/Dependency.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.plugin.standalone;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+
+/**
+ * Represents a configured tuscany dependency for boot and extension libraries.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Dependency {
+
+ /**
+ * JAR type artifact.
+ */
+ private static final String TYPE_JAR = "jar";
+
+ /**
+ * Default boot libraries. TODO Decide on whether to get snapshot version
+ * rather than hardcoded version..
+ */
+ private static final Dependency[] DEFAULT_BOOT_LIBS =
+ new Dependency[] {
+ new Dependency("org.apache.tuscany.sca.runtime.standalone",
+ "standalone-host",
+ "1.0-incubator-SNAPSHOT"),
+ // HACK to force servlet-api
+ new Dependency("javax.servlet", "servlet-api", "2.4")};
+
+ /**
+ * Group Id that is injected in from configuration.
+ */
+ private String groupId;
+
+ /**
+ * Artifact Id that is injected in from configuration.
+ */
+ private String artifactId;
+
+ /**
+ * Version that is injected in from configuration.
+ */
+ private String version;
+
+ /**
+ * Default constructor.
+ */
+ public Dependency() {
+ }
+
+ /**
+ * Initializes the field.
+ *
+ * @param groupId Group id.
+ * @param artifactId Artifact id.
+ * @param version Artifact version.
+ */
+ public Dependency(String groupId, String artifactId, String version) {
+ super();
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+
+ /**
+ * Gets the artifact using the specified artifact factory.
+ *
+ * @param artifactFactory Artifact factory to use.
+ * @return Artifact identified by the dependency.
+ */
+ public Artifact getArtifact(ArtifactFactory artifactFactory) {
+ return artifactFactory.createArtifact(groupId, artifactId, version, Artifact.SCOPE_RUNTIME, TYPE_JAR);
+ }
+
+ /**
+ * Returns the default boot libraries.
+ *
+ * @return Default boot libraries.
+ */
+ public static Dependency[] getDefaultBootLibs() {
+ return DEFAULT_BOOT_LIBS;
+ }
+
+ /**
+ * Checks whether the specified artifact has the same artifact id.
+ *
+ * @param artifact Artifact to be matched.
+ * @return True if the sepcified artifact has the same id.
+ */
+ public boolean match(Artifact artifact) {
+ return artifact.getArtifactId().equals(artifactId);
+ }
+
+}
diff --git a/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/TuscanyStandaloneMojo.java b/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/TuscanyStandaloneMojo.java
new file mode 100644
index 0000000000..faf93139ce
--- /dev/null
+++ b/sandbox/old/contrib/maven-standalone-plugin/src/main/java/org/apache/tuscany/plugin/standalone/TuscanyStandaloneMojo.java
@@ -0,0 +1,558 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.plugin.standalone;
+
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipException;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Build the tuscany war file by adding the tuscany dependencies. Performs the
+ * following tasks.
+ * <ul>
+ * <li>Adds the boot dependencies transitively to tuscany/boot</li>
+ * <li>By default boot libraries are transitively resolved from app-host</li>
+ * <li>This can be overridden using the configuration/bootLibs element in the
+ * plugin</li>
+ * <li>Adds the extension artifacts specified using configuration/extensions to
+ * tuscany/extensions</li>
+ * <li>If configuration/loadExtensionsDependency is set to true extension
+ * dependencies are transitivel loaded</li>
+ * <li>Extension dependencies are loaded into tuscany/repository directory in a
+ * Maven repo format</li>
+ * <li>Extension dependency metadata is written to
+ * tuscany/repository/dependency.metadata file</li>
+ * </ul>
+ * <p>
+ * A sample usage for this plugin:
+ * <p>
+ * <code>
+ * &lt;plugin&gt;<br/>
+ * &lt;groupId&gt;org.apache.tuscany.sca.plugins&lt;/groupId&gt;<br/>
+ * &lt;artifactId&gt;tuscany-standalone-plugin&lt;/artifactId&gt;<br/>
+ * &lt;executions&gt;<br/>
+ * &lt;execution&gt;<br/>
+ * &lt;id&gt;tuscany-standalone&lt;/id&gt;<br/>
+ * &lt;goals&gt;<br/>
+ * &lt;goal&gt;tuscany-standalone&lt;/goal&gt;<br/>
+ * &lt;/goals&gt;<br/>
+ * &lt;/execution&gt;<br/>
+ * &lt;/executions&gt;<br/>
+ * &lt;configuration&gt;<br/>
+ * &lt;loadExtensionDependencies&gt;true&lt;/loadExtensionDependencies&gt;<br/>
+ * &lt;overwrite&gt;true&lt;/overwrite&gt;<br/>
+ * &lt;extensions&gt;<br/>
+ * &lt;dependency&gt;<br/>
+ * &lt;groupId&gt;org.apache.tuscany.sca.services.bindings&lt;/groupId&gt;<br/>
+ * &lt;artifactId&gt;axis2&lt;/artifactId&gt;<br/>
+ * &lt;version&gt;${tuscanyVersion}&lt;/version&gt;<br/>
+ * &lt;/dependency&gt;<br/>
+ * &lt;dependency&gt;<br/>
+ * &lt;groupId&gt;org.apache.tuscany.sca.services.databinding&lt;/groupId&gt;<br/>
+ * &lt;artifactId&gt;databinding-sdo&lt;/artifactId&gt;<br/>
+ * &lt;version&gt;${tuscanyVersion}&lt;/version&gt;<br/>
+ * &lt;/dependency&gt;<br/>
+ * &lt;/extensions&gt;<br/>
+ * &lt;/configuration&gt;<br/>
+ * &lt;/plugin&gt;<br/>
+ * </code>
+ *
+ * @goal tuscany-standalone
+ * @phase install
+ * @version $Rev$ $Date$
+ */
+public class TuscanyStandaloneMojo extends AbstractMojo {
+
+ private static final String APP_PATH = "app";
+
+ /**
+ * Tuscany path.
+ */
+ private static final String TUSCANY_PATH = "/";
+
+ /**
+ * Tuscany launcher path.
+ */
+ private static final String LAUNCHER_PATH = TUSCANY_PATH + "bin/";
+
+ /**
+ * Tuscany lib path.
+ */
+ private static final String LIB_PATH = TUSCANY_PATH + "lib/";
+
+ /**
+ * Tuscany boot path.
+ */
+ private static final String BOOT_PATH = TUSCANY_PATH + "boot/";
+
+ /**
+ * Tuscany extension path.
+ */
+ private static final String EXTENSION_PATH = TUSCANY_PATH + "extensions/";
+
+ /**
+ * Tuscany repository path.
+ */
+ private static final String REPOSITORY_PATH = TUSCANY_PATH + "repository/";
+
+ /**
+ * Artifact metadata source.
+ *
+ * @component
+ */
+ private ArtifactMetadataSource metadataSource;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+ * @required
+ * @readonly
+ */
+ protected ArtifactResolver resolver;
+
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * List of Remote Repositories used by the resolver
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ * @required
+ */
+ private List remoteRepositories;
+
+ /**
+ * The directory for the generated ZIP.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ /**
+ * The directory for the generated ZIP.
+ *
+ * @parameter
+ */
+ private Dependency[] bootLibs = Dependency.getDefaultBootLibs();
+
+ /**
+ * The directory for the generated ZIP.
+ *
+ * @parameter
+ */
+ private Dependency[] extensions = new Dependency[0];
+
+ /**
+ * The directory for the generated WAR.
+ *
+ * @parameter
+ */
+ private Dependency[] dependencies = new Dependency[0];
+
+ /**
+ * /** The name of the generated ZIP.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String zipName;
+
+ /**
+ * A flag to indicate whether extension dependencies should be resolved
+ * transitively.
+ *
+ * @parameter
+ */
+ private boolean loadExtensionDependencies;
+
+ /**
+ * The artifactId for the project
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * Overwrite exsiting artifact?
+ *
+ * @parameter
+ */
+ private boolean overwrite = true;
+
+ /**
+ * WEB-INF jar files.
+ */
+ private Set<String> packagedLibs = new HashSet<String>();
+
+ /**
+ * Transitive dependencies for extensions.
+ */
+ private Map transDepenedencyMap = new HashMap();
+
+ private Dependency launcher =
+ new Dependency("org.apache.tuscany.sca.runtime.standalone", "launcher", "1.0-incubator-SNAPSHOT");
+
+ /**
+ * Executes the MOJO.
+ */
+ public void execute() throws MojoExecutionException {
+
+ JarOutputStream newZip = null;
+ File newZipFile = null;
+
+ try {
+
+ File originalJarFile = new File(outputDirectory, zipName + ".jar");
+
+ newZipFile = new File(outputDirectory, zipName + ".zip");
+ newZip = new JarOutputStream(new FileOutputStream(newZipFile));
+
+ // copyOriginal(originalZip, newZip);
+
+ // addEntry(newZip, TUSCANY_PATH);
+ addEntry(newZip, BOOT_PATH);
+ addEntry(newZip, EXTENSION_PATH);
+ addEntry(newZip, REPOSITORY_PATH);
+
+ newZip.putNextEntry(new JarEntry(LIB_PATH + originalJarFile.getName()));
+ InputStream jar = new FileInputStream(originalJarFile);
+ IOUtils.copy(jar, newZip);
+ IOUtils.closeQuietly(jar);
+
+ File file = new File(outputDirectory, APP_PATH);
+ file = new File(file, LIB_PATH);
+ file.mkdirs();
+
+ file = new File(file, originalJarFile.getName());
+ if (overwrite || (!file.exists())) {
+ jar = new FileInputStream(originalJarFile);
+ OutputStream fileOutputStream = new FileOutputStream(file);
+ IOUtils.copy(jar, fileOutputStream);
+ IOUtils.closeQuietly(jar);
+ IOUtils.closeQuietly(fileOutputStream);
+ }
+
+ for (Artifact art : resolveArtifact(project.getArtifact(), true)) {
+ if (art == project.getArtifact()) {
+ continue;
+ }
+ // Only add artifacts with scope "compile" or "runtime"
+ String scope = art.getScope();
+ if (scope == null || scope.equals(Artifact.SCOPE_COMPILE)
+ || scope.equals(Artifact.SCOPE_RUNTIME)) {
+ addArtifact(newZip, LIB_PATH, art);
+ }
+ }
+
+ for (Artifact art : resolveArtifact(launcher.getArtifact(artifactFactory), true)) {
+ // Only add artifacts with scope "compile" or "runtime"
+ String scope = art.getScope();
+ if (scope == null || scope.equals(Artifact.SCOPE_COMPILE)
+ || scope.equals(Artifact.SCOPE_RUNTIME)) {
+ if (art.getArtifactId().contains("launcher")) {
+ addArtifact(newZip, LAUNCHER_PATH, art);
+ } else {
+ addArtifact(newZip, LIB_PATH, art);
+ }
+ }
+ }
+
+ for (Dependency dependency : bootLibs) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory), true)) {
+ addArtifact(newZip, BOOT_PATH, art);
+ }
+ }
+
+ for (Dependency dependency : extensions) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory),
+ loadExtensionDependencies)) {
+ if (dependency.match(art)) {
+ addArtifact(newZip, EXTENSION_PATH, art);
+ }
+
+ // Load dependencies even for the extension itself
+ if (loadExtensionDependencies) {
+ loadTransitiveDependencies(newZip, art);
+ }
+
+ }
+ }
+
+ for (Dependency dependency : dependencies) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory),
+ loadExtensionDependencies)) {
+ loadTransitiveDependencies(newZip, art);
+ }
+ }
+
+ writeDependencyMetadata(newZip);
+
+ } catch (Exception ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
+ } finally {
+ IOUtils.closeQuietly(newZip);
+ }
+
+ }
+
+ /**
+ * Adds an entry to the JAR failing safe for duplicate.
+ *
+ * @param jar JAR to which the entry is added.
+ * @param entry Entry to be added.
+ * @return True if added successfully.
+ * @throws IOException In case of an IO error.
+ */
+ private boolean addEntry(JarOutputStream jar, String entry) throws IOException {
+ try {
+ jar.putNextEntry(new JarEntry(entry));
+ return true;
+ } catch (ZipException duplicateEntry) {
+ getLog().info(duplicateEntry.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * Writes the dependency metadata.
+ *
+ * @param newZip ZIP to which the metadata is written.
+ * @throws IOException In case of an IO error.
+ */
+ private void writeDependencyMetadata(JarOutputStream newZip) throws IOException {
+
+ FileOutputStream depMapOutStream = null;
+ FileInputStream depMapInStream = null;
+
+ try {
+ String metadataFile = "dependency.metadata";
+
+ File file = new File(outputDirectory, APP_PATH);
+ file = new File(file, REPOSITORY_PATH);
+ file.mkdirs();
+
+ file = new File(file, metadataFile);
+ if ((!overwrite) && file.exists()) {
+ // Try to merge the dependency map
+ InputStream is = new FileInputStream(file);
+ XMLDecoder decoder = new XMLDecoder(is);
+ Map map = (Map)decoder.readObject();
+ decoder.close();
+ for (Object o : map.entrySet()) {
+ Map.Entry e = (Map.Entry)o;
+ Set s = (Set)transDepenedencyMap.get(e.getKey());
+ if (s != null) {
+ s.addAll((Set)e.getValue());
+ }
+ }
+ }
+
+ depMapOutStream = new FileOutputStream(file);
+ XMLEncoder xmlEncoder = new XMLEncoder(depMapOutStream);
+ xmlEncoder.writeObject(transDepenedencyMap);
+ xmlEncoder.close();
+
+ if (addEntry(newZip, REPOSITORY_PATH + metadataFile)) {
+ depMapInStream = new FileInputStream(file);
+ IOUtils.copy(depMapInStream, newZip);
+ }
+
+ } finally {
+ IOUtils.closeQuietly(depMapOutStream);
+ IOUtils.closeQuietly(depMapInStream);
+ }
+
+ }
+
+ /**
+ * Builds the transitive dependencies for artifacts.
+ *
+ * @param newZip WARto which the artifacts are added.
+ * @param art Extension artifact.
+ * @throws IOException In case of an unexpected IO error.
+ * @throws ArtifactResolutionException If the artifact cannot be resolved.
+ * @throws ArtifactNotFoundException If the artifact is not found.
+ * @throws ArtifactMetadataRetrievalException In case of error in retrieving
+ * metadata.
+ */
+ private void loadTransitiveDependencies(JarOutputStream newWar, Artifact art) throws IOException,
+ ArtifactResolutionException, ArtifactNotFoundException, ArtifactMetadataRetrievalException {
+
+ String artPath = art.getGroupId() + "/" + art.getArtifactId() + "/" + art.getVersion() + "/";
+ String path = REPOSITORY_PATH + artPath;
+ addArtifact(newWar, path, art);
+
+ Set<String> transDepenedenyList = new HashSet<String>();
+ transDepenedencyMap.put(artPath, transDepenedenyList);
+
+ // Get the transitive dependencies for each dependency.
+ for (Artifact transArt : resolveArtifact(art, true)) {
+ String transArtPath =
+ transArt.getGroupId() + "/" + transArt.getArtifactId() + "/" + transArt.getVersion() + "/";
+ if (addArtifact(newWar, REPOSITORY_PATH + transArtPath, transArt)) {
+ transDepenedenyList.add(transArtPath + transArt.getFile().getName());
+ }
+ }
+
+ }
+
+ /**
+ * Resolves the specified artifact.
+ *
+ * @param artifact Artifact to be resolved.
+ * @param transitive Whether to resolve transitively.
+ * @return A set of resolved artifacts.
+ * @throws IOException In case of an unexpected IO error.
+ * @throws ArtifactResolutionException If the artifact cannot be resolved.
+ * @throws ArtifactNotFoundException If the artifact is not found.
+ * @throws ArtifactMetadataRetrievalException In case of error in retrieving
+ * metadata.
+ */
+ private Set<Artifact> resolveArtifact(Artifact artifact, boolean transitive) throws IOException,
+ ArtifactResolutionException, ArtifactNotFoundException, ArtifactMetadataRetrievalException {
+
+ Set<Artifact> resolvedArtifacts = new HashSet<Artifact>();
+
+ if (artifact != project.getArtifact()) {
+ // Resolve the artifact
+ resolver.resolve(artifact, remoteRepositories, localRepository);
+ resolvedArtifacts.add((Artifact)artifact);
+ }
+
+ if (!transitive) {
+ return resolvedArtifacts;
+ }
+
+ // Transitively resolve all the dependencies
+ ResolutionGroup resolutionGroup =
+ metadataSource.retrieve(artifact, localRepository, remoteRepositories);
+ ArtifactResolutionResult result =
+ resolver.resolveTransitively(resolutionGroup.getArtifacts(),
+ artifact,
+ remoteRepositories,
+ localRepository,
+ metadataSource);
+
+ // Add the artifacts to the deployment unit
+ for (Object depArtifact : result.getArtifacts()) {
+ resolvedArtifacts.add((Artifact)depArtifact);
+ }
+ return resolvedArtifacts;
+
+ }
+
+ /**
+ * Adds the artifact to the zip file.
+ *
+ * @param newZip Zip file to which the artifact is added.
+ * @param path Path within the zip file where artifact is added.
+ * @param artifact Artifact to be added.
+ * @throws IOException In case of an unexpected IO error.
+ */
+ private boolean addArtifact(JarOutputStream newZip, String path, Artifact artifact) throws IOException {
+
+ FileInputStream artifactStream = null;
+ FileOutputStream fileOutputStream = null;
+
+ try {
+
+ File artifactFile = artifact.getFile();
+ // For extensions, we'll add it even the packagedLibs has it
+ if ((!EXTENSION_PATH.equals(path)) && packagedLibs.contains(artifactFile.getName())) {
+ return false;
+ }
+ artifactStream = new FileInputStream(artifactFile);
+
+ newZip.putNextEntry(new JarEntry(path + artifactFile.getName()));
+
+ File file = new File(outputDirectory, APP_PATH);
+ file = new File(file, path);
+ file.mkdirs();
+
+ file = new File(file, artifactFile.getName());
+ if (overwrite || (!file.exists())) {
+ fileOutputStream = new FileOutputStream(file);
+ IOUtils.copy(artifactStream, fileOutputStream);
+ IOUtils.closeQuietly(artifactStream);
+ }
+
+ artifactStream = new FileInputStream(artifactFile);
+ IOUtils.copy(artifactStream, newZip);
+
+ packagedLibs.add(artifactFile.getName());
+
+ getLog().info("Processed " + path + artifactFile.getName());
+ return true;
+
+ } finally {
+ IOUtils.closeQuietly(artifactStream);
+ IOUtils.closeQuietly(fileOutputStream);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/old-doc/extending.chianti.doc b/sandbox/old/contrib/old-doc/extending.chianti.doc
new file mode 100644
index 0000000000..aff0da08a8
--- /dev/null
+++ b/sandbox/old/contrib/old-doc/extending.chianti.doc
Binary files differ
diff --git a/sandbox/old/contrib/old-doc/extending.tuscany.ppt b/sandbox/old/contrib/old-doc/extending.tuscany.ppt
new file mode 100644
index 0000000000..842574b32a
--- /dev/null
+++ b/sandbox/old/contrib/old-doc/extending.tuscany.ppt
Binary files differ
diff --git a/sandbox/old/contrib/old-doc/tuscany.architecture.ppt b/sandbox/old/contrib/old-doc/tuscany.architecture.ppt
new file mode 100644
index 0000000000..23f83d5d24
--- /dev/null
+++ b/sandbox/old/contrib/old-doc/tuscany.architecture.ppt
Binary files differ
diff --git a/sandbox/old/contrib/old-doc/tuscany.architecture.v4.pdf b/sandbox/old/contrib/old-doc/tuscany.architecture.v4.pdf
new file mode 100644
index 0000000000..97e88a1ac1
--- /dev/null
+++ b/sandbox/old/contrib/old-doc/tuscany.architecture.v4.pdf
Binary files differ
diff --git a/sandbox/old/contrib/old-doc/tuscany.architecture.v4.ppt b/sandbox/old/contrib/old-doc/tuscany.architecture.v4.ppt
new file mode 100644
index 0000000000..5cf51fac34
--- /dev/null
+++ b/sandbox/old/contrib/old-doc/tuscany.architecture.v4.ppt
Binary files differ
diff --git a/sandbox/old/contrib/old-samples/LICENSE.txt b/sandbox/old/contrib/old-samples/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/old-samples/NOTICE.txt b/sandbox/old/contrib/old-samples/NOTICE.txt
new file mode 100644
index 0000000000..2d290a2ed5
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/NOTICE.txt
@@ -0,0 +1,14 @@
+Apache Tuscany Core Samples
+Copyright (c) 2005 - 2007 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/old/contrib/old-samples/common/calculator/LICENSE.txt b/sandbox/old/contrib/old-samples/common/calculator/LICENSE.txt
new file mode 100644
index 0000000000..bdec70a4fa
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/LICENSE.txt
@@ -0,0 +1,416 @@
+
+ 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.
+
+===============================================================================================================
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+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.
+
+===================================================================================================
+
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON 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 a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, 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. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
+
+
+
+
diff --git a/sandbox/old/contrib/old-samples/common/calculator/NOTICE.txt b/sandbox/old/contrib/old-samples/common/calculator/NOTICE.txt
new file mode 100644
index 0000000000..4dbc3a8099
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/NOTICE.txt
@@ -0,0 +1,32 @@
+Apache Tuscany SCA for Java
+Copyright 2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+ . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
diff --git a/sandbox/old/contrib/old-samples/common/calculator/pom.xml.off b/sandbox/old/contrib/old-samples/common/calculator/pom.xml.off
new file mode 100644
index 0000000000..77c327fee7
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>common</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples.common</groupId>
+ <artifactId>calculator</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Calculator Common Composite</name>
+ <description>A sample Calculator made of several SCA components wired together.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/old-samples/common/calculator/readme.html b/sandbox/old/contrib/old-samples/common/calculator/readme.html
new file mode 100644
index 0000000000..b42e31f089
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/readme.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Tuscany Simple Calculator Sample</title>
+ <link rel="stylesheet" href="../../css/samples.css" type="text/css">
+</head>
+
+<body>
+<h1>Common Calculator Composite</h1>
+
+<h2>Overview</h2>
+<p>
+ This sample illustrates the use of SCA to wire components together inside a composite.
+ All connections between the components are local and are defined using Java interfaces.
+</p>
+</body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddService.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddServiceImpl.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorService.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideService.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideServiceImpl.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyService.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractService.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractServiceImpl.java b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/autowire.default.scdl b/sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/autowire.default.scdl
new file mode 100644
index 0000000000..1c5f9b1ed0
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/autowire.default.scdl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CalculatorComposite"
+ autowire="true">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..d78713e869
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CalculatorComposite">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/old-samples/common/calculator/src/test/java/calculator/CalculatorTestComponent.java b/sandbox/old/contrib/old-samples/common/calculator/src/test/java/calculator/CalculatorTestComponent.java
new file mode 100644
index 0000000000..1f75ebcd4c
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/test/java/calculator/CalculatorTestComponent.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestComponent extends TestCase {
+
+ @Reference
+ public CalculatorService calculatorService;
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ assertEquals(calculatorService.add(3, 2), 5.0);
+ assertEquals(calculatorService.subtract(3, 2), 1.0);
+ assertEquals(calculatorService.multiply(3, 2), 6.0);
+ assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/common/calculator/src/test/resources/itest.scdl b/sandbox/old/contrib/old-samples/common/calculator/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..b3fcfc531d
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/calculator/src/test/resources/itest.scdl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="CalculatorTestHarnessComposite">
+
+ <!-- To use autowire instead of manually specifying reference targets, comment out the default.scdl include and uncomment the autowre.default.scdl include -->
+ <include name="CalculatorComposite" scdlResource="META-INF/sca/default.scdl"/>
+ <!-- <include name="CalculatorComposite" scdlResource="META-INF/sca/autowire.default.scdl"/> -->
+
+ <component name="testComponent">
+ <tuscany:junit class="calculator.CalculatorTestComponent"/>
+ <reference name="calculatorService" target="CalculatorServiceComponent"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/old-samples/common/pom.xml.off b/sandbox/old/contrib/old-samples/common/pom.xml.off
new file mode 100644
index 0000000000..bc7b262b76
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/pom.xml.off
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>core-samples</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>common</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Core Samples Common Composites</name>
+ <description>Common composites used by other Core Samples.</description>
+
+ <modules>
+ <module>calculator</module>
+ </modules>
+</project>
diff --git a/sandbox/old/contrib/old-samples/common/readme.html b/sandbox/old/contrib/old-samples/common/readme.html
new file mode 100644
index 0000000000..ace822fbd7
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/common/readme.html
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Apache Tuscany Sample Common Composites</title>
+ <link rel="stylesheet" href="../css/samples.css" type="text/css">
+</head>
+<body>
+<p>
+ This module contains common composites that are shared by other sample applications.
+ The Maven build packages each one, runs its integration tests to confirm that it runs
+ in the local environment, and then installs the composite in the local repository.
+</p>
+<p>
+ The common composites are:
+</p>
+<table width="100%">
+ <tr><th align="left" width="10%">Module</th><th align="left">Description</th></tr>
+ <tr><td><a href="calculator/">calculator</a></td><td>A simple four-function calculator.</tr>
+</table>
+</body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/css/samples.css b/sandbox/old/contrib/old-samples/css/samples.css
new file mode 100644
index 0000000000..410a505fce
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/css/samples.css
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+pre.command {
+ border-style: solid;
+ border-width: 1px;
+ font-family: monospace;
+ margin-left: 5%;
+ margin-right: 5%;
+ padding-top: 10px;
+ padding-left: 3%;
+ padding-right: 3%;
+ padding-bottom: 10px;
+ background-color: rgb(230,230,230);
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/old-samples/faq.html b/sandbox/old/contrib/old-samples/faq.html
new file mode 100644
index 0000000000..37f3c6ac7a
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/faq.html
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Sample FAQs for Apache Tuscany</title>
+ <link rel="stylesheet" href="css/samples.css" type="text/css">
+</head>
+<body>
+<h1>Apache Tuscany Sample FAQ</h1>
+Freqently Asked Questions about building and running sample applications.
+</body>
+</html> \ No newline at end of file
diff --git a/sandbox/old/contrib/old-samples/pom.xml.off b/sandbox/old/contrib/old-samples/pom.xml.off
new file mode 100644
index 0000000000..8e7bbb070b
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/pom.xml.off
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>core-samples</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Core Samples</name>
+ <description>Sample projects that illustrate core concepts for SCA and Tuscany.</description>
+
+ <properties>
+ <!-- version the SCA API that we implement -->
+ <scaSpecVersion>1.0</scaSpecVersion>
+
+ <!-- version the Apache Tuscany kernel that the runtimes work with -->
+ <kernelVersion>2.0-alpha-incubating</kernelVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <modules>
+ <module>common</module>
+ </modules>
+</project>
diff --git a/sandbox/old/contrib/old-samples/readme.html b/sandbox/old/contrib/old-samples/readme.html
new file mode 100644
index 0000000000..cea10e77b5
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/readme.html
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Apache Tuscany Sample Applications</title>
+ <link rel="stylesheet" href="css/samples.css" type="text/css">
+</head>
+<body>
+<h1>Apache Tuscany Sample Applications</h1>
+<p>
+ Thank you for your interest in Apache Tuscany in using the Service Component Architecture (SCA)
+ for building applications. This package contains a number of samples that illustrate some of
+ the core concepts in SCA and shows how to build and run them using Apache Tuscany.
+</p>
+
+<h2>Pre-requisites</h2>
+
+<p>
+ The samples assume that you have certain tools in your local environment, specifically:
+</p>
+<ul>
+ <li>a Java5 development kit</li>
+ <li><a href="http://maven.apache.org/download.html">Apache Maven v2.0.4</a> or later</li>
+</ul>
+<p>To run the web application samples you will also require a J2EE 1.4 web container such as
+ <a href="http://tomcat.apache.org/download-55.cgi">Apache Tomcat 5.5</a>
+</p>
+
+<h2 id="GettingStarted">Getting Started</h2>
+
+<p>
+ Many of the samples use pre-built SCA composites that implement the services they are using.
+ These need to be built before any of the individual samples. To do this run:
+</p>
+<pre class="command">
+$ mvn install
+</pre>
+<p>
+ from this directory.
+</p>
+<p>
+ Please see the <a href="common/readme.html">common</a> module for information on these composites.
+</p>
+<h3>Standalone Samples</h3>
+<p>
+ These sample applications are intended to be run in a standalone environment in conjunction
+ with an installed version of Apache Tuscany. You can download a distribution from
+ <a href="http://people.apache.org/dist/incubator/tuscany/java/sca/">http://people.apache.org/dist/incubator/tuscany/java/sca/</a>
+</p>
+<p>
+ Please see the <a href="standalone/readme.html">standalone</a> module for specific details on running these samples.
+</p>
+<h3>Web Application Samples</h3>
+<p>
+ These sample applications are intended to be run in a standard web container such as Apache Tomcat
+ or Jetty. The projects for these use a Maven plugin to package a standard WAR file that can then be deployed
+ to the web container using its standard deployment tools. An Apache Tuscany distribution does not need
+ to be included on your local machine as the Tuscany runtime is automatically downloaded by the
+ Maven plugin.
+</p>
+<p>
+ Please see the <a href="webapp/readme.html">webapp</a> module for specific details on running these samples.
+</p>
+<h2>Frequently Asked Questions</h2>
+<p>Help! Something is not working right ...</p>
+<p>
+ Please see the <a href="faq.html">faq</a> page in this directory for more information.
+ Additional help may also be found on the <a href="http://cwiki.apache.org/TUSCANY/tuscany-sca-faq.html">project wiki</a>
+</p>
+<p>
+ You can also contact the project members directly on the mailing list
+ <a href="mailto:tuscany-user@ws.apache.org">tuscany-user@ws.apache.org</a>
+</p>
+</body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/LICENSE.txt b/sandbox/old/contrib/old-samples/standalone/calculator/LICENSE.txt
new file mode 100644
index 0000000000..bdec70a4fa
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/LICENSE.txt
@@ -0,0 +1,416 @@
+
+ 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.
+
+===============================================================================================================
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+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.
+
+===================================================================================================
+
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON 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 a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, 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. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
+
+
+
+
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/NOTICE.txt b/sandbox/old/contrib/old-samples/standalone/calculator/NOTICE.txt
new file mode 100644
index 0000000000..4dbc3a8099
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/NOTICE.txt
@@ -0,0 +1,32 @@
+Apache Tuscany SCA for Java
+Copyright 2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+ . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/pom.xml.off b/sandbox/old/contrib/old-samples/standalone/calculator/pom.xml.off
new file mode 100644
index 0000000000..c206388234
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/pom.xml.off
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples.standalone</groupId>
+ <artifactId>calc</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Calculator Client Sample</name>
+ <description>A sample Calculator that runs from the command line.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.core-samples.common</groupId>
+ <artifactId>calculator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/readme.html b/sandbox/old/contrib/old-samples/standalone/calculator/readme.html
new file mode 100644
index 0000000000..5fac063c10
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/readme.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Apache Tuscany Calculator Sample Application</title>
+ <link rel="stylesheet" href="../../css/samples.css" type="text/css">
+</head>
+<body>
+<h1>Apache Tuscany Calculator Sample Application</h1>
+
+<p>
+ This sample illustrates the use of SCA to wire components together inside a composite.
+ All connections between the components are local and are defined using Java interfaces.
+</p>
+
+<h2>Setup</h2>
+<p>
+ Please install Apache Maven and build the library composites as described in the
+ <a href="../../readme.html#GettingStarted">Getting Started</a> section of the root readme.
+</p>
+
+<h2>Building</h2>
+
+<p>To build the sample run:</p>
+ <pre class="command">
+$ mvn package
+</pre>
+<p>
+ This will build and package the code that calls the calculator composite from a
+ command line client environment.
+</p>
+
+<h2>Running</h2>
+<p>
+ To run the client, use the <code>launcher</code> command from the standalone distribution:
+</p>
+<pre class="command">
+$ java -jar {tuscany.installDir}/bin/launcher.jar target/calc.jar {add|subtract|multiply|divide} {param} {param}
+</pre>
+
+<p>where <code>tuscany.installDir</code> is the path where you installed the standalone distribution.</p>
+
+<p>
+ The sample when run will display to the standard output:
+</p>
+<pre class="command">
+$ java -jar {tuscany.installDir}/bin/launcher.jar target/calc.jar add 2 5
+result = 7.0
+</pre>
+</body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorClient.java b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..74c24b9a2c
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the Calculator service and invoke it.
+ */
+public class CalculatorClient {
+
+ private CalculatorService calculatorService;
+
+ @Reference
+ public void setCalculatorService(CalculatorService calculatorService) {
+ this.calculatorService = calculatorService;
+ }
+
+ public int main(String[] args) throws Exception {
+
+ if(args.length != 3) {
+ System.err.println("usage: <add|substract|multiply|divide> <operand1> <operand2>");
+ return 1;
+ }
+
+ double result;
+ if("add".equals(args[0])) {
+ result = calculatorService.add(Double.parseDouble(args[1]), Double.parseDouble(args[2]));
+ } else if("subtract".equals(args[0])) {
+ result = calculatorService.subtract(Double.parseDouble(args[1]), Double.parseDouble(args[2]));
+ } else if("multiply".equals(args[0])) {
+ result = calculatorService.multiply(Double.parseDouble(args[1]), Double.parseDouble(args[2]));
+ } else if("divide".equals(args[0])) {
+ result = calculatorService.divide(Double.parseDouble(args[1]), Double.parseDouble(args[2]));
+ } else {
+ throw new IllegalArgumentException("Usage <add|substract|multiply|divide> <operand1> <operand2>");
+ }
+ System.out.println("result = " + result);
+ return 0;
+ }
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorService.java b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/autowire.default.scdl b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/autowire.default.scdl
new file mode 100644
index 0000000000..16a4a377dd
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/autowire.default.scdl
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="CalculatorComposite"
+ autowire="true">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/sca/2.0-alpha">
+ <group>org.apache.tuscany.sca.core-samples.common</group>
+ <name>calculator</name>
+ <version>2.0-alpha-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="CalculatorClient">
+ <tuscany:launched class="calculator.CalculatorClient"/>
+ <reference name="calculatorService" target="CalculatorServiceComponent"/>
+ </component>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..1a4476bec8
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="CalculatorComposite">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/sca/2.0-alpha">
+ <group>org.apache.tuscany.sca.core-samples.common</group>
+ <name>calculator</name>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="CalculatorClient">
+ <tuscany:launched class="calculator.CalculatorClient"/>
+ <reference name="calculatorService" target="CalculatorServiceComponent"/>
+ </component>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/old-samples/standalone/calculator/src/test/java/calculator/CalculatorClientTestCase.java b/sandbox/old/contrib/old-samples/standalone/calculator/src/test/java/calculator/CalculatorClientTestCase.java
new file mode 100644
index 0000000000..d4580f954e
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/calculator/src/test/java/calculator/CalculatorClientTestCase.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CalculatorClientTestCase extends TestCase {
+ private CalculatorClient client;
+ private CalculatorService mockService;
+
+ public void testAdd() throws Exception {
+ double result = 5;
+ EasyMock.expect(mockService.add(2.0, 3.0)).andReturn(result);
+ EasyMock.replay(mockService);
+ // The main returns 0 (status) instead of the result
+ assertEquals(0, client.main(new String[] {"add", "2", "3"}));
+ EasyMock.verify(mockService);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ client = new CalculatorClient();
+ mockService = EasyMock.createMock(CalculatorService.class);
+ client.setCalculatorService(mockService);
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/LICENSE.txt b/sandbox/old/contrib/old-samples/standalone/loanapplication/LICENSE.txt
new file mode 100644
index 0000000000..bdec70a4fa
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/LICENSE.txt
@@ -0,0 +1,416 @@
+
+ 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.
+
+===============================================================================================================
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+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.
+
+===================================================================================================
+
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON 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 a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, 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. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
+
+
+
+
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/NOTICE.txt b/sandbox/old/contrib/old-samples/standalone/loanapplication/NOTICE.txt
new file mode 100644
index 0000000000..4dbc3a8099
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/NOTICE.txt
@@ -0,0 +1,32 @@
+Apache Tuscany SCA for Java
+Copyright 2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+ . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/pom.xml.off b/sandbox/old/contrib/old-samples/standalone/loanapplication/pom.xml.off
new file mode 100644
index 0000000000..3aa6937d7c
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/pom.xml.off
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples.standalone</groupId>
+ <artifactId>loan-application</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Loan Application Client Sample</name>
+ <description>A sample demonstrating the use of asynchronous and conversational services.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/readme.html b/sandbox/old/contrib/old-samples/standalone/loanapplication/readme.html
new file mode 100644
index 0000000000..ec6eff8548
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/readme.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=us-ascii">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+ <title>Tuscany Loan Application Conversational and Callback Services Sample</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+ <h3>Tuscany Loan Application Conversational and Callback Services Sample</h3>
+
+ <h4>Overview</h4>
+
+ <p>This sample illustrates the use of conversational services and callbacks in Tuscany.</p>
+
+ <h4>Location</h4>
+
+ <p>The sample is located &nbsp;in the
+ samples\standalone\loanapplication directory. All commands should be issued while working in the sample
+ directory.</p>
+
+ <h4>Prerequisites</h4>
+
+ <p>Obtain the following prerequisites and install according to
+ their documentation.</p>
+
+ <ul>
+ <li><a href="http://java.sun.com/javase/downloads/index.jsp"
+ target="_blank">JDK 5.0</a></li>
+
+ <li><a href="http://maven.apache.org/download.html" target=
+ "_blank">Maven 2.0.4</a></li>
+ </ul>
+
+ <h4>Building</h4>
+
+ <p>To build the sample&nbsp; issue :</p>
+ <pre>
+<code>mvn install<br></code>
+</pre>
+
+ <p>The result after executing is in the <span style=
+ "font-weight: bold;">target</span> subdirectory the <span style=
+ "font-weight: bold;">loan-application.jar</span></p>
+
+ <h4>Running</h4>
+
+ <p>Boot the Tuscany standalone runtime environment using the
+ following command:</p>
+ <pre>
+<code>java -jar {path-to-launcher.jar} target/loan-application.jar <br></code>
+</pre>
+
+ <p>where {path-to-launcher.jar} is the path to the Tuscany launcher jar </p>
+
+ <pre>
+<code></code>
+</pre>
+
+ <h4>Results</h4>
+
+ </body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/ClientService.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/ClientService.java
new file mode 100644
index 0000000000..2c2fcaf1e0
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/ClientService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.client;
+
+/**
+ * Interacts with the {@link loanapplication.provider.LoanService}, initiating a loan application process that
+ * demonstrates the use of conversational services and callbacks
+ */
+public interface ClientService {
+
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/impl/ClientServiceImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/impl/ClientServiceImpl.java
new file mode 100644
index 0000000000..cfda4558f6
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/client/impl/ClientServiceImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.client.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import loanapplication.client.ClientService;
+import loanapplication.message.Application;
+import loanapplication.message.LoanPackage;
+import loanapplication.message.impl.ApplicationImpl;
+import loanapplication.provider.LoanService;
+import loanapplication.provider.LoanServiceCallback;
+
+/**
+ * Demonstrates a client to the conversational loan service that receives a set of callbacks. This component
+ * implementation is configured as a Tuscany "launched" component type. The standalone launcher will invoke {@link
+ * #main(String[])} when the application is started.
+ */
+@Service(ClientService.class)
+@Scope("COMPOSITE")
+public class ClientServiceImpl implements ClientService, LoanServiceCallback {
+ private LoanService loanService;
+
+ /**
+ * Instantiates a new client with a reference to the loan service
+ *
+ * @param loanService the loan service
+ */
+ public ClientServiceImpl(@Reference(name = "loanService")LoanService loanService) {
+ this.loanService = loanService;
+ }
+
+ /**
+ * The method invoked to initiate a new application process.
+ *
+ * @param args startup parameters
+ * @return the return code
+ */
+ public int main(String[] args) {
+ System.out.println("Client applying for loan");
+ Application app = new ApplicationImpl();
+ app.setCustomerID("12345");
+ app.setAmount(100000);
+ app.setTerm(30);
+ app.setType(Application.FIXED);
+ loanService.apply(app);
+ return 1;
+ }
+
+ public void creditScoreResult(int code) {
+ System.out.println("Callback: credit score was " + code);
+ }
+
+ public void applicationResult(int code) {
+ if (code == APPROVED) {
+ System.out.println("Callback: the loan has been approved");
+ System.out.println("Client securing loan");
+ loanService.secureLoan();
+ } else {
+ System.out.println("Callback: the loan has been declined");
+ }
+ }
+
+ public void loanPackage(LoanPackage loanPackage) {
+ System.out.println("Callback: loan package received");
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java
new file mode 100644
index 0000000000..0d689f79b7
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.message;
+
+/**
+ * A loan application
+ */
+public interface Application {
+ int FIXED = 1;
+ int FIVE_YEAR_VARIABLE = 2;
+
+ String getCustomerID();
+
+ void setCustomerID(String customerID);
+
+ float getAmount();
+
+ void setAmount(float amount);
+
+ float getDownPayment();
+
+ void setDownPayment(float downPayment);
+
+ int getType();
+
+ void setType(int type);
+
+ int getTerm();
+
+ void setTerm(int term);
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java
new file mode 100644
index 0000000000..cd8cdcc04d
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.message;
+
+/**
+ * Contains information for a completed loan
+ */
+public interface LoanPackage {
+
+ String getLoanNumber();
+
+ void setLoanNumber(String loanNumber);
+
+ int getType();
+
+ void setType(int type);
+
+ float getAmount();
+
+ void setAmount(float amount);
+
+ float getRate();
+
+ void setRate(float rate);
+
+ int getTerm();
+
+ void setTerm(int term);
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java
new file mode 100644
index 0000000000..7b0049b8a5
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.message.impl;
+
+import java.io.Serializable;
+
+import loanapplication.message.Application;
+
+/**
+ * A simple implementation of an Application
+ */
+public class ApplicationImpl implements Application, Serializable {
+ private static final long serialVersionUID = -4289535647716763141L;
+ private float amount;
+ private float downPayment;
+ private String customerID;
+ private int type;
+ private int term;
+
+ public float getAmount() {
+ return amount;
+ }
+
+ public void setAmount(float amount) {
+ this.amount = amount;
+ }
+
+ public float getDownPayment() {
+ return downPayment;
+ }
+
+ public void setDownPayment(float downPayment) {
+ this.downPayment = downPayment;
+ }
+
+ public String getCustomerID() {
+ return customerID;
+ }
+
+ public void setCustomerID(String customerID) {
+ this.customerID = customerID;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getTerm() {
+ return term;
+ }
+
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java
new file mode 100644
index 0000000000..4beee06b57
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.message.impl;
+
+import java.io.Serializable;
+
+import loanapplication.message.LoanPackage;
+
+/**
+ * A simple implementation of a LoanPackage
+ */
+public class LoanPackageImpl implements LoanPackage, Serializable {
+ private static final long serialVersionUID = 51755060138169723L;
+ private int type;
+ private float amount;
+ private float rate;
+ private int term;
+ private String loanNumber;
+
+ public String getLoanNumber() {
+ return loanNumber;
+ }
+
+ public void setLoanNumber(String loanNumber) {
+ this.loanNumber = loanNumber;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public float getAmount() {
+ return amount;
+ }
+
+ public void setAmount(float amount) {
+ this.amount = amount;
+ }
+
+ public float getRate() {
+ return rate;
+ }
+
+ public void setRate(float rate) {
+ this.rate = rate;
+ }
+
+ public int getTerm() {
+ return term;
+ }
+
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java
new file mode 100644
index 0000000000..38444abbd4
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider;
+
+/**
+ * Performs a credit check on a customer
+ */
+public interface CreditService {
+
+ /**
+ * Returns the customer credit score
+ *
+ * @param customerID the customer ID
+ * @return the credit score
+ */
+ int getCreditScore(String customerID);
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java
new file mode 100644
index 0000000000..c9eb01dbb3
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+import loanapplication.message.Application;
+
+/**
+ * Defines the loan service contract.
+ */
+@Conversational
+@Callback(LoanServiceCallback.class)
+public interface LoanService {
+
+ /**
+ * Submits a new loan application. Calling this method will start a new conversation if one has not been previously
+ * initiated.
+ *
+ * @param application the loan application
+ */
+ void apply(Application application);
+
+ /**
+ * Called after the loan has been approved and when the client is read to complete the process. Calling this method
+ * will end the conversation.
+ */
+ @EndsConversation
+ void secureLoan();
+
+ /**
+ * Called to cancel a loan application. Calling this method will end the conversation.
+ */
+ @EndsConversation
+ void cancel();
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java
new file mode 100644
index 0000000000..8b67017a55
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider;
+
+import loanapplication.message.LoanPackage;
+
+/**
+ * Defines the callback contract for loan service clients
+ */
+public interface LoanServiceCallback {
+ int APPROVED = 1;
+ int DECLINED = -1;
+
+ /**
+ * Called when the customer's credit score is received from the credit check process.
+ *
+ * @param code the customer's credit score.
+ */
+ void creditScoreResult(int code);
+
+ /**
+ * Called to the loan has been {@link LoanServiceCallback#APPROVED} or {@link LoanServiceCallback#DECLINED}.
+ *
+ * @param code if the loan application was approved or declined.
+ */
+ void applicationResult(int code);
+
+ /**
+ * Called after the loan has been secured to provide the completed loan information.
+ *
+ * @param loanPackage the loan information.
+ */
+ void loanPackage(LoanPackage loanPackage);
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/RateService.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/RateService.java
new file mode 100644
index 0000000000..6d53c7d6b7
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/RateService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider;
+
+/**
+ *
+ */
+public interface RateService {
+
+ float getRate(int type);
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java
new file mode 100644
index 0000000000..86c5f722d1
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider.impl;
+
+import loanapplication.provider.CreditService;
+
+/**
+ * The credit service implementation
+ */
+public class CreditServiceImpl implements CreditService {
+
+ public int getCreditScore(String customerID) {
+ System.out.println("Credit Service: Performing credit check");
+ return 700;
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java
new file mode 100644
index 0000000000..fc36ec1d53
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider.impl;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+import loanapplication.message.Application;
+import loanapplication.provider.CreditService;
+import loanapplication.provider.LoanService;
+import loanapplication.provider.LoanServiceCallback;
+import loanapplication.provider.RateService;
+
+/**
+ * The loan service implementation
+ */
+@Scope("CONVERSATION")
+public class LoanServiceImpl implements LoanService, Serializable {
+ private static final long serialVersionUID = 7801583139613235069L;
+ // the loan number, demonstrates the use of conversational state
+ private String loanNumber;
+ private CreditService creditService;
+ private RateService rateService;
+ private LoanServiceCallback callback;
+
+ /**
+ * Instantiates a new component instance, passing in references to the credit and rate services
+ *
+ * @param creditService the credit service
+ * @param rateService the rate service
+ */
+ public LoanServiceImpl(@Reference(name = "creditService", required = true)CreditService creditService,
+ @Reference(name = "rateService", required = true)RateService rateService) {
+ this.creditService = creditService;
+ this.rateService = rateService;
+ }
+
+ /**
+ * A setter method for injecting the client callback reference. The reference will be injected by the runtime
+ *
+ * @param callback the client callback reference
+ */
+ @Callback
+ public void setCallback(LoanServiceCallback callback) {
+ this.callback = callback;
+ }
+
+ public void apply(Application application) {
+ String id = application.getCustomerID();
+ loanNumber = UUID.randomUUID().toString();
+ System.out.println("---------------------------------------------------------------------");
+ System.out.println("Application received for customer");
+ System.out.println("Assigned loan number: " + loanNumber);
+ System.out.println("---------------------------------------------------------------------");
+ int rating = creditService.getCreditScore(id);
+ if (rating > 500) {
+ // approve the loan
+ callback.creditScoreResult(rating);
+ rateService.getRate(application.getType());
+ callback.applicationResult(LoanServiceCallback.APPROVED);
+ } else {
+ // reject the loan
+ callback.creditScoreResult(rating);
+ callback.applicationResult(LoanServiceCallback.DECLINED);
+ }
+ }
+
+ public void secureLoan() {
+ System.out.println("---------------------------------------------------------------------");
+ System.out.println("Loan secured");
+ System.out.println("Loan number: " + loanNumber);
+ System.out.println("---------------------------------------------------------------------");
+ }
+
+ public void cancel() {
+ System.out.println("---------------------------------------------------------------------");
+ System.out.println("Loan cancelled");
+ System.out.println("Loan number: " + loanNumber);
+ System.out.println("---------------------------------------------------------------------");
+ }
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/RateServiceImpl.java b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/RateServiceImpl.java
new file mode 100644
index 0000000000..6860b465ea
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/RateServiceImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication.provider.impl;
+
+import loanapplication.message.Application;
+import loanapplication.provider.RateService;
+
+/**
+ * The rate service implementation
+ */
+public class RateServiceImpl implements RateService {
+
+ public float getRate(int type) {
+ System.out.println("Rate Service: Calculating rate");
+ if (type == Application.FIVE_YEAR_VARIABLE) {
+ return 6.0f;
+ } else {
+ return 6.5f;
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..7b9c840588
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="LoanApplication">
+
+ <component name="LoanClient">
+ <tuscany:launched class="loanapplication.client.impl.ClientServiceImpl"/>
+ <reference name="loanService" target="LoanService"/>
+ </component>
+
+ <component name="LoanService">
+ <implementation.java class="loanapplication.provider.impl.LoanServiceImpl"/>
+ <reference name="creditService" target="CreditService"/>
+ <reference name="rateService" target="RateService"/>
+ </component>
+
+ <component name="CreditService">
+ <implementation.java class="loanapplication.provider.impl.CreditServiceImpl"/>
+ </component>
+
+ <component name="RateService">
+ <implementation.java class="loanapplication.provider.impl.RateServiceImpl"/>
+ </component>
+
+</composite>
+
+<!-- Alternatively, the following demonstrates the same assembly using autowire instead of direct reference targets -->
+<!--
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="LoanApplication"
+ autowire="true">
+ <component name="LoanClient">
+ <tuscany:launched class="loanapplication.client.impl.ClientServiceImpl"/>
+ </component>
+
+ <component name="LoanService">
+ <implementation.java class="loanapplication.provider.impl.LoanServiceImpl"/>
+ </component>
+
+ <component name="CreditService">
+ <implementation.java class="loanapplication.provider.impl.CreditServiceImpl"/>
+ </component>
+
+ <component name="RateService">
+ <implementation.java class="loanapplication.provider.impl.RateServiceImpl"/>
+ </component>
+
+</composite>
+-->
diff --git a/sandbox/old/contrib/old-samples/standalone/pom.xml.off b/sandbox/old/contrib/old-samples/standalone/pom.xml.off
new file mode 100644
index 0000000000..22b0d00e02
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/standalone/pom.xml.off
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>core-samples</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>standalone</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Core Samples Standalone</name>
+ <description>Sample projects that run in the standalone environment.</description>
+
+</project>
diff --git a/sandbox/old/contrib/old-samples/webapp/pom.xml.off b/sandbox/old/contrib/old-samples/webapp/pom.xml.off
new file mode 100644
index 0000000000..34447362b1
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/pom.xml.off
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>core-samples</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>webapp</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Core Samples Webapp</name>
+ <description>Sample projects that run in the webapp environment.</description>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${kernelVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>${kernelVersion}</version>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/LICENSE.txt b/sandbox/old/contrib/old-samples/webapp/webcalc/LICENSE.txt
new file mode 100644
index 0000000000..bdec70a4fa
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/LICENSE.txt
@@ -0,0 +1,416 @@
+
+ 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.
+
+===============================================================================================================
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+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.
+
+===================================================================================================
+
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON 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 a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, 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. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
+
+
+
+
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/NOTICE.txt b/sandbox/old/contrib/old-samples/webapp/webcalc/NOTICE.txt
new file mode 100644
index 0000000000..4dbc3a8099
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/NOTICE.txt
@@ -0,0 +1,32 @@
+Apache Tuscany SCA for Java
+Copyright 2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other successful
+ASF projects. While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be fully endorsed
+by the ASF.
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE.txt file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+The terms and conditions governing the distribution may refer to the AL or other license
+agreements, notices or terms and conditions. Some of these other license agreements may
+include (but are not limited to):
+
+ . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html)
+ . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+It is your obligation to read and accept all such terms and conditions prior to use of the
+distribution. If term or condition is provided, please contact the Apache Software Foundation
+to determine what terms and conditions govern that particular distribution.
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/pom.xml.off b/sandbox/old/contrib/old-samples/webapp/webcalc/pom.xml.off
new file mode 100644
index 0000000000..e7836a033d
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/pom.xml.off
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.core-samples</groupId>
+ <artifactId>webapp</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.core-samples.webapp</groupId>
+ <artifactId>webcalc</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany WebApp Calculator Sample</name>
+ <description>A sample using an SCA composite a web application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.core-samples.common</groupId>
+ <artifactId>calculator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/readme.html b/sandbox/old/contrib/old-samples/webapp/webcalc/readme.html
new file mode 100644
index 0000000000..1f7cde1bbb
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/readme.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=us-ascii">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+ <title>Tuscany Webapp Sample</title>
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <!-- maven --><!-- end maven -->
+
+ <h3>Tuscany Webapp Sample</h3>
+
+ <h4>Overview</h4>
+
+ <p>This sample illustrates how to use Apache Tuscany to run a SCA composite inside a
+web application. It describes how to run it on Apache Tomcat but the application
+should be portable to other containers such as Jetty or commmercial servers.</p>
+
+ <h4>Location</h4>
+
+ <p>This sample is located&nbsp;in the&nbsp; <a href=
+ ".">samples\webapp\webapp</a> directory. &nbsp;All
+ the following commands should be issued while working in the
+ sample directory.&nbsp;</p>
+
+ <h4>Prerequisites</h4>
+
+ <p>Obtain the following prerequisites and install according to
+ their documentation.</p>
+
+ <ul>
+ <li><a href="http://java.sun.com/javase/downloads/index.jsp"
+ target="_blank">JDK 5.0</a></li>
+
+ <li><a href="http://maven.apache.org/download.html" target=
+ "_blank">Maven 2.0.4</a></li>
+
+ <li><a href="http://tomcat.apache.org/download-55.cgi" target=
+ "_blank">Apache Tomcat 5.xx</a> latest version binary core
+ distribution.&nbsp;</li>
+
+ <li>This sample reuses the composite from the &nbsp;<a href= "../../standalone/calculator/readme.html" target="_blank">calculator sample</a>&nbsp;
+ so that sample must have beed built before building this sample.</li>
+ </ul>
+
+ <h4>Building</h4>
+
+ <p>To build the sample issue :</p>
+ <pre>
+<code>mvn</code>
+</pre>
+
+ <p>This should result in the creation of the war file
+ <span style="font-weight: bold;">target\sample-webapp.war</span></p>
+
+ <h4>Setup</h4>
+
+ <p>If you have enabled remote deployment in Tomcat by adding the
+ line:</p>
+
+ <p><code>&lt;user username="admin" password=""
+ roles="manager"/&gt;</code></p>
+
+ <p>into <span style="font-style: italic;">&lt;tomcat
+ dir&gt;</span>\conf\tomcat-users.xml you can deploy the WARs to
+ Tomcat using the tomcat-maven-plugin:</p>
+
+ <p><code>mvn tomcat:deploy</code></p>
+
+ <p>Alternatively you can copy the WAR files to Tomcat's webapps
+ directory. Copy <span style=
+ "font-weight: bold;">target\sample-webapp.war</span>
+ <span style="font-style: italic;">&lt;tomcat
+ dir&gt;</span>/webapps/.</p>
+
+ <h4>Running</h4>
+
+ <p>Start the tomcat server by issuing the following command ind
+ the <span style="font-style: italic;">&lt;tomcat
+ dir&gt;</span>\bin directory:</p>
+
+ <p><code>startup</code></p>
+
+ <p>Once you've started your web server, open a browser and go to sample-webapp page at
+&nbsp;<a href=
+ "http://localhost:8080/sample-webapp/" target=
+ "_blank">http://localhost:8080/sample-webapp/</a>&nbsp; and you should see a web page displaying:</p>
+<samp>
+<br><B>Expression Result</B>
+<br>2 + 3 5.0
+<br>3 - 2 1.0
+</samp>
+</body>
+</html>
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/default.scdl b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/default.scdl
new file mode 100644
index 0000000000..d159fd7a38
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/default.scdl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="CalculatorComposite">
+
+ <!-- config that includes the calculator composite -->
+ <include name="CalculatorComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="webcalc">
+ <tuscany:webapp>
+ <reference name="calculatorService" interface="calculator.CalculatorService"/>
+ </tuscany:webapp>
+ <reference name="calculatorService" target="CalculatorServiceComponent"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/web.xml b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..2232ddc3ef
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>Apache Tuscany Simple Webapp Sample</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <context-param>
+ <param-name>tuscany.component</param-name>
+ <param-value>webcalc</param-value>
+ </context-param>
+</web-app>
diff --git a/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/calc.jsp b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..f561f82ea4
--- /dev/null
+++ b/sandbox/old/contrib/old-samples/webapp/webcalc/src/main/webapp/calc.jsp
@@ -0,0 +1,40 @@
+<%@ page import="calculator.CalculatorService" %>
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ CalculatorService calc = (CalculatorService) application.getAttribute("calculatorService");
+%>
+<html>
+<head><title>Calculator Sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calc.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calc.subtract(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html> \ No newline at end of file
diff --git a/sandbox/old/contrib/persistence/common/LICENSE.txt b/sandbox/old/contrib/persistence/common/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/persistence/common/NOTICE.txt b/sandbox/old/contrib/persistence/common/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/persistence/common/pom.xml.off b/sandbox/old/contrib/persistence/common/pom.xml.off
new file mode 100644
index 0000000000..9b5bf4c6ef
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/pom.xml.off
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>persistence-common</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JPA</name>
+ <description>Tuscany JPA Integration.</description>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+
+
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>apache-snapshots</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.transaction</groupId>
+ <artifactId>tuscany-transaction-geronimo</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ <version>0.9.0-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilder.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilder.java
new file mode 100644
index 0000000000..684eee8c09
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilder.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+import javax.persistence.spi.PersistenceUnitInfo;
+
+/**
+ * Default implementation of the persistence unit builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPersistenceUnitBuilder implements PersistenceUnitBuilder {
+
+ /** Persistence unit scanner */
+ private PersistenceUnitScanner scanner = new PersistenceUnitScanner();
+
+ /**
+ * Builds the entity manager factory matching the unit name. All persistence.xml
+ * files available for the specified classloader is scanned for the specified
+ * persistence unit. The JPA provider API is used to create the entity manager
+ * factory.
+ *
+ * @param unitName Persistence unit name.
+ * @param classLoader Classloader.
+ * @return Entity manager factory.
+ */
+ public EntityManagerFactory newEntityManagerFactory(String unitName, ClassLoader classLoader) {
+
+ PersistenceUnitInfo info = scanner.getPersistenceUnitInfo(unitName, classLoader);
+ String providerClass = info.getPersistenceProviderClassName();
+ try {
+ Map overrides = new HashMap();
+ PersistenceProvider provider = (PersistenceProvider) Class.forName(providerClass).newInstance();
+ return provider.createContainerEntityManagerFactory(info, overrides);
+ } catch (InstantiationException ex) {
+ throw new TuscanyJpaException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new TuscanyJpaException(ex);
+ } catch (ClassNotFoundException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/EntityManagerProxy.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/EntityManagerProxy.java
new file mode 100644
index 0000000000..492bd36689
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/EntityManagerProxy.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Properties;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * Proxy for entity manager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerProxy implements InvocationHandler {
+
+ // Thread local cache of entity managers
+ private ThreadLocal<EntityManager> entityManagers = new ThreadLocal<EntityManager>();
+
+ // Properties
+ private Properties prop;
+
+ // Entity manager factory
+ private EntityManagerFactory emf;
+
+ // Transaction manager
+ private TransactionManager txm;
+
+ /**
+ * Initializes the artifacts required to create an EM.
+ *
+ * @param prop EM creation porperty overrides.
+ * @param emf Entity manager factory to use.
+ * @param txm Transaction manager to use.
+ */
+ public EntityManagerProxy(Properties prop, EntityManagerFactory emf, TransactionManager txm) {
+ this.prop = prop;
+ this.txm = txm;
+ this.emf = emf;
+ }
+
+ /**
+ * Proxies the entity manager.
+ */
+ public Object invoke(Object target, Method method, Object[] parameters) throws Throwable {
+
+ EntityManager entityManager = entityManagers.get();
+ if(entityManager != null) {
+ entityManager = emf.createEntityManager(prop);
+ entityManagers.set(entityManager);
+ Transaction tx = txm.getTransaction();
+ if(tx != null) {
+ tx.registerSynchronization(new Synchronization() {
+ public void afterCompletion(int arg0) {
+ entityManagers.set(null);
+ }
+ public void beforeCompletion() {
+ }
+ });
+ }
+ }
+ return method.invoke(entityManager, parameters);
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/JpaConstants.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/JpaConstants.java
new file mode 100644
index 0000000000..04d1c419ca
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/JpaConstants.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+public class JpaConstants {
+
+ public static final String PROPERTY_VALUE = "value";
+
+ public static final String PROPERTY_NAME = "name";
+
+ public static final String PROPERTY = "//persistence-unit/properties/property";
+
+ public static final String TRANSACTION_TYPE = "//persistence-unit/@transaction-type";
+
+ public static final String NAME = "//persistence-unit/@name";
+
+ public static final String PROVIDER = "//persistence-unit/provider";
+
+ public static final String NON_JTA_DATA_SOURCE = "//persistence-unit/non-jta-data-source";
+
+ public static final String MAPPING_FILE = "//persistence-unit/mapping-file";
+
+ public static final String CLASS = "//persistence-unit/class";
+
+ public static final String JTA_DATA_SOURCE = "//persistence-unit/jta-data-source";
+
+ public static final String JAR_FILE = "//persistence-unit/jar-file";
+
+ public static final String EXCLUDE_UNLISTED_CLASSES = "//persistence-unit/exclude-unlisted-classes";
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceContextProcessor.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceContextProcessor.java
new file mode 100644
index 0000000000..9d247fae43
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceContextProcessor.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.PersistenceProperty;
+import javax.transaction.TransactionManager;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.RegistrationException;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.InterfaceJavaIntrospector;
+import org.apache.tuscany.spi.implementation.java.AbstractPropertyProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.tuscany.core.component.ComponentManager;
+
+/**
+ * Annotation processor for injecting <code>PersistenceUnit</code> annotations on properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PersistenceContextProcessor extends AbstractPropertyProcessor<PersistenceContext> {
+
+ /**
+ * Transaction Manager
+ */
+ private TransactionManager transactionManager;
+ private ComponentManager componentManager;
+ private InterfaceJavaIntrospector introspector;
+
+ /**
+ * Persistence unit builder
+ */
+ private PersistenceUnitBuilder builder = new DefaultPersistenceUnitBuilder();
+
+ /**
+ * Injects the implementation processor service.
+ *
+ * @param service Implementation processor service.
+ */
+ public PersistenceContextProcessor(@Reference ImplementationProcessorService service) {
+ super(PersistenceContext.class, service);
+ }
+
+ @Reference
+ public void setTransactionManager(TransactionManager transactionManager) {
+ this.transactionManager = transactionManager;
+ }
+
+ @Reference
+ public void setComponentManager(ComponentManager componentManager) {
+ this.componentManager = componentManager;
+ }
+
+ @Reference
+ public void setIntrospector(InterfaceJavaIntrospector introspector) {
+ this.introspector = introspector;
+ }
+
+ /**
+ * Defaults to the field name.
+ */
+ @Override
+ protected String getName(PersistenceContext persistenceContext) {
+ return null;
+ }
+
+ /**
+ * Initializes the property.
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ PersistenceContext annotation,
+ DeploymentContext context) throws ProcessingException {
+
+ String unitName = annotation.unitName();
+ URI unitUri = context.getComponentId().resolve(unitName);
+ EntityManagerFactory emf = (EntityManagerFactory) componentManager.getComponent(unitUri);
+
+ if (emf == null) {
+ emf = builder.newEntityManagerFactory(unitName, context.getClassLoader());
+ try {
+ ServiceContract<EntityManagerFactory> contract =
+ (ServiceContract) introspector.introspect(EntityManagerFactory.class);
+ componentManager.registerJavaObject(unitUri, contract, emf);
+ } catch (RegistrationException e) {
+ throw new ProcessingException(e);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ }
+ ObjectFactory factory = new EmObjectFactory(emf, annotation);
+ property.setDefaultValueFactory(factory);
+
+ }
+
+ private class EmObjectFactory implements ObjectFactory<EntityManager> {
+
+ private EntityManagerFactory emf;
+ private PersistenceContext annotation;
+
+ public EmObjectFactory(EntityManagerFactory emf, PersistenceContext annotation) {
+ this.emf = emf;
+ this.annotation = annotation;
+ }
+
+ public EntityManager getInstance() {
+
+ PersistenceContextType type = annotation.type();
+ if (type == PersistenceContextType.TRANSACTION) {
+
+ Properties props = new Properties();
+ for (PersistenceProperty property : annotation.properties()) {
+ props.put(property.name(), property.value());
+ }
+
+ Class[] interfaces = new Class[]{EntityManager.class};
+ InvocationHandler handler = new EntityManagerProxy(props, emf, transactionManager);
+ EntityManager em =
+ (EntityManager) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces, handler);
+ return em;
+
+ } else {
+ throw new UnsupportedOperationException("Extended persistence contexts not supported");
+ }
+
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitBuilder.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitBuilder.java
new file mode 100644
index 0000000000..d8d30d6811
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitBuilder.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import javax.persistence.EntityManagerFactory;
+
+/**
+ * Interface for building persistence units as specified by the JPA specification..
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PersistenceUnitBuilder {
+
+ /**
+ * Builds the entity manager factory matching the unit name. All persistence.xml files available for the specified
+ * classloader is scanned for the specified persistence unit. The JPA provider API is used to create the entity
+ * manager factory.
+ *
+ * @param unitName Persistence unit name.
+ * @param classLoader Classloader.
+ * @return Entity manager factory.
+ */
+ public EntityManagerFactory newEntityManagerFactory(String unitName, ClassLoader classLoader);
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitProcessor.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitProcessor.java
new file mode 100644
index 0000000000..169f48fec7
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitProcessor.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.lang.reflect.Field;
+import java.net.URI;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.RegistrationException;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.InterfaceJavaIntrospector;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.tuscany.core.component.ComponentManager;
+
+/**
+ * Annotation processor for injecting <code>PersistenceUnit</code> annotations on properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PersistenceUnitProcessor extends ImplementationProcessorExtension {
+ /**
+ * Persistence unit builder
+ */
+ private PersistenceUnitBuilder builder = new DefaultPersistenceUnitBuilder();
+ private ComponentManager componentManager;
+ private InterfaceJavaIntrospector introspector;
+
+ @Reference
+ public void setComponentManager(ComponentManager componentManager) {
+ this.componentManager = componentManager;
+ }
+
+ @Reference
+ public void setIntrospector(InterfaceJavaIntrospector introspector) {
+ this.introspector = introspector;
+ }
+
+
+ @SuppressWarnings({"unchecked"})
+ public void visitField(Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ PersistenceUnit annotation = field.getAnnotation(PersistenceUnit.class);
+ if (annotation == null) {
+ return;
+ }
+ String unitName = annotation.unitName();
+ URI unitUri = context.getComponentId().resolve(unitName);
+ AtomicComponent component = (AtomicComponent) componentManager.getComponent(unitUri);
+ EntityManagerFactory emf;
+ if (component == null) {
+ emf = builder.newEntityManagerFactory(unitName, context.getClassLoader());
+ try {
+ ServiceContract<EntityManagerFactory> contract =
+ (ServiceContract) introspector.introspect(EntityManagerFactory.class);
+ componentManager.registerJavaObject(unitUri, contract, emf);
+ } catch (RegistrationException e) {
+ throw new ProcessingException(e);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ } else {
+ try {
+ emf = (EntityManagerFactory) component.getTargetInstance();
+ } catch (TargetException e) {
+ throw new ProcessingException(e);
+ }
+ }
+
+ ObjectFactory factory = new EmfObjectFactory(emf);
+ Resource resource = new Resource(unitName, field.getType(), field);
+ resource.setObjectFactory(factory);
+ type.add(resource);
+ }
+
+ private class EmfObjectFactory implements ObjectFactory<EntityManagerFactory> {
+
+ private EntityManagerFactory emf;
+
+ public EmfObjectFactory(EntityManagerFactory emf) {
+ this.emf = emf;
+ }
+
+ public EntityManagerFactory getInstance() {
+ return emf;
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScanner.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScanner.java
new file mode 100644
index 0000000000..00fd02b891
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScanner.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.spi.PersistenceUnitInfo;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Scans the classloader for the specified persistence unit.
+ *
+ * @version $Rev$ $Date$
+ */
+class PersistenceUnitScanner {
+
+ /** Cache of persistence unit info */
+ private Map<String, PersistenceUnitInfo> persistenceUnitInfos = new HashMap<String, PersistenceUnitInfo>();
+
+ /**
+ * Scans the lassloader for the specified persistence unit and creates
+ * an immutable representation of the information present in the matching
+ * persistence.xml file.
+ *
+ * @param unitName Persistence unit name.
+ * @param classLoader Classloader to scan.
+ * @return Persistence unit information.
+ */
+ PersistenceUnitInfo getPersistenceUnitInfo(String unitName, ClassLoader classLoader) {
+
+ synchronized (persistenceUnitInfos) {
+
+ if(persistenceUnitInfos.containsKey(unitName)) {
+ return persistenceUnitInfos.get(unitName);
+ }
+
+ try {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ Enumeration<URL> persistenceUnitUrls = classLoader.getResources("META-INF/persistence.xml");
+ while (persistenceUnitUrls.hasMoreElements()) {
+
+ URL persistenceUnitUrl = persistenceUnitUrls.nextElement();
+ Document persistenceDom = db.parse(persistenceUnitUrl.openStream());
+
+ String rootJarUrl = persistenceUnitUrl.toString();
+ rootJarUrl = rootJarUrl.substring(0, rootJarUrl.lastIndexOf("META-INF"));
+
+ PersistenceUnitInfo info = new TuscanyPersistenceUnitInfo(persistenceDom, classLoader, rootJarUrl);
+ if (!unitName.equals(info.getPersistenceUnitName())) {
+ continue;
+ }
+
+ persistenceUnitInfos.put(unitName, info);
+ return info;
+
+ }
+ } catch (IOException ex) {
+ throw new TuscanyJpaException(ex);
+ } catch (ParserConfigurationException ex) {
+ throw new TuscanyJpaException(ex);
+ } catch (SAXException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+ throw new TuscanyJpaException("Unabel to find persistence unit: " + unitName);
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyJpaException.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyJpaException.java
new file mode 100644
index 0000000000..2690f43f7c
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyJpaException.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Unexpected exception in processing JPA annotations.
+ *
+ */
+public class TuscanyJpaException extends TuscanyRuntimeException {
+
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 2772746952304093785L;
+
+ /**
+ * Initializes the message.
+ * @param message Message to be initialized.
+ */
+ public TuscanyJpaException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initializes the underlying cause.
+ * @param cause Cause to be initialized.
+ */
+ public TuscanyJpaException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyPersistenceUnitInfo.java b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyPersistenceUnitInfo.java
new file mode 100644
index 0000000000..eb1dee24a7
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/TuscanyPersistenceUnitInfo.java
@@ -0,0 +1,288 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.persistence.spi.ClassTransformer;
+import javax.persistence.spi.PersistenceUnitInfo;
+import javax.persistence.spi.PersistenceUnitTransactionType;
+import javax.sql.DataSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import static org.apache.tuscany.service.persistence.common.JpaConstants.*;
+
+/**
+ * Encpasulates the information in the persistence.xml file.
+ *
+ * This class is expected to be interogated by the provider only
+ * during the creation of the entity manager factory. Hence none
+ * of the values are cached, rather every time a property is queried
+ * the underlying DOM is interogated.
+ *
+ */
+class TuscanyPersistenceUnitInfo implements PersistenceUnitInfo {
+
+ /** Persistence DOM */
+ private Node persistenceDom;
+
+ /** Classloader */
+ private ClassLoader classLoader;
+
+ /** Root Url */
+ private String rootUrl;
+
+ /** XPath API */
+ XPath xpath = XPathFactory.newInstance().newXPath();
+
+ /**
+ * Initializes the properties.
+ *
+ * @param persistenceDom
+ * @param classLoader
+ * @param rootUrl
+ */
+ public TuscanyPersistenceUnitInfo(Node persistenceDom, ClassLoader classLoader, String rootUrl) {
+ this.persistenceDom = persistenceDom;
+ this.classLoader = classLoader;
+ this.rootUrl = rootUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer)
+ */
+ public void addTransformer(ClassTransformer classTransformer) {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#excludeUnlistedClasses()
+ */
+ public boolean excludeUnlistedClasses() {
+ return getBooleanValue(persistenceDom, EXCLUDE_UNLISTED_CLASSES);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getClassLoader()
+ */
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getJarFileUrls()
+ */
+ public List<URL> getJarFileUrls() {
+
+ List<String> jarFiles = getMultipleValues(persistenceDom, JAR_FILE);
+ try {
+ List<URL> jarUrls = new LinkedList<URL>();
+ for (String jarFile : jarFiles) {
+ jarUrls.add(new URL(jarFile));
+ }
+ return jarUrls;
+ } catch (MalformedURLException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
+ */
+ public DataSource getJtaDataSource() {
+
+ String jtaDsName = getSingleValue(persistenceDom, JTA_DATA_SOURCE);
+ if (jtaDsName == null || "".equals(jtaDsName)) {
+ return null;
+ }
+ return lookupDataSource(jtaDsName);
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getManagedClassNames()
+ */
+ public List<String> getManagedClassNames() {
+ return getMultipleValues(persistenceDom, CLASS);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getMappingFileNames()
+ */
+ public List<String> getMappingFileNames() {
+ return getMultipleValues(persistenceDom, MAPPING_FILE);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()
+ */
+ public ClassLoader getNewTempClassLoader() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
+ */
+ public DataSource getNonJtaDataSource() {
+
+ String nonJtaDsName = getSingleValue(persistenceDom, NON_JTA_DATA_SOURCE);
+ if (nonJtaDsName == null || "".equals(nonJtaDsName)) {
+ return null;
+ }
+ return lookupDataSource(nonJtaDsName);
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceProviderClassName()
+ */
+ public String getPersistenceProviderClassName() {
+ return getSingleValue(persistenceDom, PROVIDER);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
+ */
+ public String getPersistenceUnitName() {
+ return getSingleValue(persistenceDom, NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitRootUrl()
+ */
+ public URL getPersistenceUnitRootUrl() {
+ try {
+ return new URL(rootUrl);
+ } catch (MalformedURLException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getProperties()
+ */
+ public Properties getProperties() {
+ return getProperties(persistenceDom);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.persistence.spi.PersistenceUnitInfo#getTransactionType()
+ */
+ public PersistenceUnitTransactionType getTransactionType() {
+ String transactionType = getSingleValue(persistenceDom, TRANSACTION_TYPE);
+ return "JTA".equals(transactionType) ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL;
+ }
+
+ /*
+ * Extracts additional properties.
+ */
+ private Properties getProperties(Node root) {
+
+ try {
+ NodeList nodeList = (NodeList) xpath.evaluate(PROPERTY, root, XPathConstants.NODESET);
+ Properties data = new Properties();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Element property = (Element) nodeList.item(i);
+ data.put(property.getAttribute(PROPERTY_NAME), property.getAttribute(PROPERTY_VALUE));
+ }
+
+ return data;
+ } catch (XPathExpressionException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+ /*
+ * Gets multiple values for the specified expression.
+ */
+ private List<String> getMultipleValues(Node context, String expression) {
+
+ try {
+ NodeList nodeList = (NodeList) xpath.evaluate(expression, context, XPathConstants.NODESET);
+ List<String> data = new LinkedList<String>();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ data.add(nodeList.item(i).getTextContent());
+ }
+
+ return data;
+ } catch (XPathExpressionException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+ /*
+ * Gets single value for the specified expression.
+ */
+ private String getSingleValue(Node context, String expression) {
+
+ try {
+ return xpath.evaluate(expression, context);
+ } catch (XPathExpressionException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+
+ }
+
+ /*
+ * Gets single value for the specified expression.
+ */
+ private boolean getBooleanValue(Node context, String expression) {
+ return Boolean.valueOf(getSingleValue(context, expression));
+ }
+
+ /*
+ * Looks up datasource.
+ */
+ private DataSource lookupDataSource(String dsName) {
+ Context ctx = null;
+ try {
+ ctx = new InitialContext();
+ return (DataSource) ctx.lookup(dsName);
+ } catch (NamingException ex) {
+ throw new TuscanyJpaException(ex);
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (NamingException ex) {
+ throw new TuscanyJpaException(ex);
+ }
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/main/resources/META-INF/sca/jpa.scdl b/sandbox/old/contrib/persistence/common/src/main/resources/META-INF/sca/jpa.scdl
new file mode 100644
index 0000000000..1166ade155
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/main/resources/META-INF/sca/jpa.scdl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Implementation">
+
+ <!-- Implementation processor for JPA annotations. -->
+ <component name="jpa.persistenceUnit">
+ <system:implementation.system class="org.apache.tuscany.service.persistence.common.PersistenceUnitProcessor"/>
+ </component>
+
+ <component name="jpa.persistenceContext">
+ <system:implementation.system class="org.apache.tuscany.service.persistence.common.PersistenceContextProcessor"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java
new file mode 100644
index 0000000000..cd3a914ab9
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import junit.framework.TestCase;
+
+public class DefaultPersistenceUnitBuilderTestCase extends TestCase {
+
+ public void testNewEntityManagerFactory() {
+ new DefaultPersistenceUnitBuilder().newEntityManagerFactory("test", getClass().getClassLoader());
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java
new file mode 100644
index 0000000000..bbbd32fa87
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Department {
+
+ @Id
+ private Long id;
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java
new file mode 100644
index 0000000000..d90e3284eb
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Employee {
+
+ @Id
+ private Long id;
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java
new file mode 100644
index 0000000000..b8d7c53d4d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.common;
+
+import junit.framework.TestCase;
+
+public class PersistenceUnitScannerTestCase extends TestCase {
+
+ public void testGetPersistenceUnitInfo() {
+
+ new PersistenceUnitScanner().getPersistenceUnitInfo("test", getClass().getClassLoader());
+
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java
new file mode 100644
index 0000000000..6b6fb7ad43
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java
@@ -0,0 +1,32 @@
+package org.apache.tuscany.service.persistence.common;
+
+import junit.framework.TestCase;
+
+public class PersistenceUnitTestCase extends TestCase {
+
+ protected void setUp() throws Exception {
+/*
+ addExtension("tuscany.jpa", getClass().getClassLoader().getResource("META-INF/sca/jpa.scdl"));
+ addExtension("geronimo.jta", getClass().getClassLoader().getResource("META-INF/sca/geronimo.jta.scdl"));
+ setApplicationSCDL(getClass().getClassLoader().getResource("META-INF/sca/test1.scdl"));
+ super.setUp();
+ RuntimeComponent runtime = (RuntimeComponent) component.getParent().getParent();
+ CompositeComponent systemComposite = runtime.getSystemComponent();
+ CompositeComponent topLevelComposite = (CompositeComponent) systemComposite.getSystemChild(TUSCANY_SYSTEM);
+
+ JavaAtomicComponent cmp = (JavaAtomicComponent) component.getChild("TestService1");
+ TestService1 testService1 = (TestService1) cmp.getTargetInstance();
+ testService1.testMethod();
+*/
+ }
+
+ protected void tearDown() throws Exception {
+/*
+ super.tearDown();
+*/
+ }
+
+ public void testGetComponent() {
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java
new file mode 100644
index 0000000000..74052984b9
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java
@@ -0,0 +1,26 @@
+package org.apache.tuscany.service.persistence.common;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.api.annotation.Resource;
+
+public class TestService1 {
+
+ @Resource
+ protected TransactionManager tx;
+
+ @PersistenceUnit(unitName = "test")
+ protected EntityManagerFactory emf;
+
+ public void testMethod() throws Exception {
+
+ tx.begin();
+ EntityManager em = emf.createEntityManager();
+ tx.commit();
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/persistence.xml b/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000000..0fc71881db
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.tuscany.service.persistence.common.Employee</class>
+ <class>org.apache.tuscany.service.persistence.common.Department</class>
+ <properties>
+ <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:tutorial_database"/>
+ <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver"/>
+ <property name="openjpa.ConnectionUserName" value="sa"/>
+ <property name="openjpa.ConnectionPassword" value=""/>
+ <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
+ </properties>
+ </persistence-unit>
+</persistence> \ No newline at end of file
diff --git a/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/sca/test1.scdl b/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/sca/test1.scdl
new file mode 100644
index 0000000000..4470ca506e
--- /dev/null
+++ b/sandbox/old/contrib/persistence/common/src/test/resources/META-INF/sca/test1.scdl
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="LocalWireComposite">
+
+ <component name="TestService1">
+ <implementation.java class="org.apache.tuscany.service.persistence.common.TestService1"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/persistence/datasource/.ruleset b/sandbox/old/contrib/persistence/datasource/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/persistence/datasource/LICENSE.txt b/sandbox/old/contrib/persistence/datasource/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/persistence/datasource/NOTICE.txt b/sandbox/old/contrib/persistence/datasource/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/persistence/datasource/pom.xml.off b/sandbox/old/contrib/persistence/datasource/pom.xml.off
new file mode 100644
index 0000000000..be6d9bf0b9
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/pom.xml.off
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>persistence-datasource</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Datasource Extension</name>
+ <description>A DataSource provider for Tuscany.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/AmbiguousPropertyException.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/AmbiguousPropertyException.java
new file mode 100644
index 0000000000..40bebc58b6
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/AmbiguousPropertyException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+/**
+ * Raised when a property cannot be unambiguously inferred using JavaBean introspection rules, e.g. when a method is
+ * overloaded.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AmbiguousPropertyException extends LoaderException {
+ public AmbiguousPropertyException() {
+ }
+
+ public AmbiguousPropertyException(String message) {
+ super(message);
+ }
+
+ public AmbiguousPropertyException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java
new file mode 100644
index 0000000000..326c526adf
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URI;
+import javax.sql.DataSource;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.model.TypeInfo;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+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.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Loads the component type for a DataSource component. Component type information is currently static, although this
+ * could be changed in the future to allow for configuration parameter checking for specific providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DSComponentTypeLoader extends ComponentTypeLoaderExtension<DataSourceImplementation> {
+ private SimpleTypeMapperExtension extension = new SimpleTypeMapperExtension();
+
+ public DSComponentTypeLoader(@Reference LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ protected Class<DataSourceImplementation> getImplementationClass() {
+ return DataSourceImplementation.class;
+ }
+
+ public void load(DataSourceImplementation implementation, DeploymentContext ctx)
+ throws LoaderException {
+ ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> componentType =
+ new ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();
+ componentType.setImplementationScope(Scope.COMPOSITE);
+ JavaServiceContract serviceContract = new JavaServiceContract(DataSource.class);
+ ServiceDefinition service = new ServiceDefinition(URI.create("#DataSource"), serviceContract, false);
+ componentType.add(service);
+ componentType.setInitLevel(1);
+ Class<?> provider;
+ try {
+ provider = implementation.getClassLoader().loadClass(implementation.getProviderName());
+ } catch (ClassNotFoundException e) {
+ throw new LoaderException(e);
+ }
+ introspectProperties(componentType, provider);
+ implementation.setComponentType(componentType);
+ }
+
+ /**
+ * Creates properties by introspecting the provider class an d including all JavaBean setters that take a simple
+ * type parameter
+ *
+ * @param componentType
+ * @param provider
+ * @throws AmbiguousPropertyException
+ */
+ @SuppressWarnings("unchecked")
+ private void introspectProperties(ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> componentType,
+ Class<?> provider) throws AmbiguousPropertyException {
+
+ Method[] methods = provider.getMethods();
+ for (Method method : methods) {
+ String name = method.getName();
+ if (method.getParameterTypes().length == 1 && name.startsWith("set")) {
+ String propName = Character.toLowerCase(name.charAt(3)) + name.substring(4);
+ Class<Type> type = (Class<Type>) method.getParameterTypes()[0];
+ TypeInfo info = extension.getXMLType(type);
+ if (info != null) {
+ // only include methods as properties that take simple type parameters
+ if (componentType.getProperties().containsKey(propName)) {
+ throw new AmbiguousPropertyException(propName);
+ }
+ JavaMappedProperty<Type> property =
+ new JavaMappedProperty<Type>(propName, info.getQName(), type);
+ property.setMember(method);
+ componentType.add(property);
+ }
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceBuilder.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceBuilder.java
new file mode 100644
index 0000000000..50f87d07f5
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceBuilder.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+/**
+ * Builds a {@link DataSourceComponent} from its model representation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataSourceBuilder extends ComponentBuilderExtension<DataSourceImplementation> {
+ protected Class<DataSourceImplementation> getImplementationType() {
+ return DataSourceImplementation.class;
+ }
+
+ public Component build(ComponentDefinition<DataSourceImplementation> definition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+ try {
+ DataSourceImplementation implementation = definition.getImplementation();
+ ClassLoader classLoader = implementation.getClassLoader();
+ Class<?> beanClass = classLoader.loadClass(implementation.getProviderName());
+ List<Injector> injectors = new ArrayList<Injector>();
+ // handle properties
+ ComponentType type = definition.getImplementation().getComponentType();
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ String name = property.getName();
+ JavaMappedProperty mappedProperty = (JavaMappedProperty) type.getProperties().get(name);
+ if (mappedProperty == null) {
+ throw new MissingPropertyException(name);
+ }
+ Injector injector = new Injector((Method) mappedProperty.getMember(), factory);
+ injectors.add(injector);
+ }
+ }
+ ProviderObjectFactory providerFactory = new ProviderObjectFactory(beanClass, injectors);
+ int initLevel = implementation.getComponentType().getInitLevel();
+ return new DataSourceComponent(definition.getUri(), providerFactory, initLevel);
+ } catch (ClassNotFoundException e) {
+ throw new BuilderConfigException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceCloseException.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceCloseException.java
new file mode 100644
index 0000000000..3398c47913
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceCloseException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import org.apache.tuscany.spi.component.TargetDestructionException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataSourceCloseException extends TargetDestructionException {
+
+ public DataSourceCloseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java
new file mode 100644
index 0000000000..c73fce31ef
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+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;
+
+/**
+ * A system component that creates <code>DataSource</code> instances. The component uses a {@link ProviderObjectFactory}
+ * to instantiate the actual <code>DataSource</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataSourceComponent extends AtomicComponentExtension {
+ private ProviderObjectFactory instanceFactory;
+
+ /**
+ * Creates a <code>DataSourceComponent</code>
+ *
+ * @param uri the uri of the component
+ * @param instanceFactory the provider factory
+ * @param initLevel the initialization level
+ */
+ public DataSourceComponent(URI uri,
+ ProviderObjectFactory instanceFactory,
+ int initLevel) {
+
+ super(uri, null, null, initLevel, -1, -1);
+ this.instanceFactory = instanceFactory;
+ }
+
+ public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ return null;
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ return instanceFactory.getInstance();
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return null;
+ }
+
+
+ public Object getAssociatedTargetInstance() throws TargetResolutionException {
+ return null;
+ }
+
+ public void destroy(Object instance) throws TargetDestructionException {
+ if (instance instanceof DataSourceProvider) {
+ try {
+ ((DataSourceProvider) instance).close();
+ } catch (ProviderException e) {
+ throw new DataSourceCloseException("Error closing data source provider", e);
+ }
+ }
+ }
+
+ public List<Wire> getWires(String name) {
+ return null;
+ }
+
+ public void attachCallbackWire(Wire wire) {
+
+ }
+
+ public void attachWire(Wire wire) {
+
+ }
+
+ public void attachWires(List<Wire> wires) {
+
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementation.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementation.java
new file mode 100644
index 0000000000..d0e3413ca8
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementation.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Represents a DataSource component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataSourceImplementation extends Implementation<ComponentType> {
+ private String providerName;
+ private ClassLoader classLoader;
+ private Map<String, String> configurationParams = new HashMap<String, String>();
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public Map<String, String> getConfigurationParams() {
+ return configurationParams;
+ }
+
+ public void addConfigurationParam(String name, String val) {
+ this.configurationParams.put(name, val);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoader.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoader.java
new file mode 100644
index 0000000000..4401b0f087
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoader.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+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.loader.LoaderUtil;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Loads a DataSource component type from an assembly. This component implementation type provides a
+ * <code>DataSource</code> system service in the runtime. The actual DataSource provider is pluggable, for example,
+ * Commons DBCP could be used. DataSource components are configured as follows:
+ * <pre>
+ * <p/>
+ * <component name="MyDataSource">
+ * <system:implementation.ds provider="org.foo.FooProvider"/>
+ * <property name="driverClassName">com.mysql.jdbc.Driver</property>
+ * <property name="url">jdbc:mysql://localhost:3306/mydb</property>
+ * <property name="login">foo</property>
+ * <property name="password">bar</property>
+ * </component>
+ * <p/>
+ * </pre>
+ * In the above example, <code>org.foo.FooProvider</code> is responsible for bootstrapping the actual DataSource
+ * implementation. It may implement <code>javax.sql.DataSource</code> directly or the {@link DataSourceProvider}
+ * interface and must have a public no-args constructor. Configuration parameters are simple types specified as
+ * properties. Configuration parameters, i.e. properties, will vary are introspected from the provider class. A
+ * component type containing thse properties is dynamically generated and consists of all JavaBean setter methods that
+ * take a single simple type parameter.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataSourceImplementationLoader extends LoaderExtension {
+ private static final QName DATASOURCE =
+ new QName("http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT", "implementation.ds");
+ private static final String PROVIDER = "provider";
+
+ public DataSourceImplementationLoader(@Reference LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return DATASOURCE;
+ }
+
+ public ModelObject load(
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ String driverName = reader.getAttributeValue(null, PROVIDER);
+ if (driverName == null) {
+ throw new LoaderException("No provider specified for DataSource");
+ }
+
+ DataSourceImplementation implementation = new DataSourceImplementation();
+ implementation.setProviderName(driverName);
+ implementation.setClassLoader(deploymentContext.getClassLoader());
+ LoaderUtil.skipToEndElement(reader);
+ return implementation;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceProvider.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceProvider.java
new file mode 100644
index 0000000000..d29089be6d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceProvider.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import javax.sql.DataSource;
+
+/**
+ * DataSource providers may optionally implement this interface to receive callback notifications
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataSourceProvider {
+
+ /**
+ * Signals to the provider to initialize after all parameters have been set
+ *
+ * @throws ProviderException if an exception occurs during initialization
+ */
+ void init() throws ProviderException;
+
+ /**
+ * Signals to the provider to close any open resources and prepare for shutdown
+ *
+ * @throws ProviderException if an exception occurs during shutdown
+ */
+ void close() throws ProviderException;
+
+ /**
+ * Returns a new <code>DataSource</code> instance that will be bound into a composite system service tree. Called
+ * after initialize.
+ *
+ * @throws ProviderException if an error occurs creating a new instance
+ */
+ DataSource getDataSource() throws ProviderException;
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/Injector.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/Injector.java
new file mode 100644
index 0000000000..82903afe93
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/Injector.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Injects a value on a method
+ *
+ * @version $Rev$ $Date$
+ */
+public class Injector {
+ private final Method method;
+ private final ObjectFactory<?> objectFactory;
+
+ public Injector(Method method, ObjectFactory<?> objectFactory) {
+ this.method = method;
+ this.method.setAccessible(true);
+ this.objectFactory = objectFactory;
+ }
+
+ public void inject(Object instance) throws IllegalAccessException, InvocationTargetException {
+ method.invoke(instance, objectFactory.getInstance());
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/MissingPropertyException.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/MissingPropertyException.java
new file mode 100644
index 0000000000..ac5a8a0b55
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/MissingPropertyException.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+
+/**
+ * Raised when a property value is specified in an assembly configuration and no corresponding property was found in the
+ * component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingPropertyException extends BuilderConfigException {
+ public MissingPropertyException() {
+ }
+
+ public MissingPropertyException(String message) {
+ super(message);
+ }
+
+ public MissingPropertyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public MissingPropertyException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderException.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderException.java
new file mode 100644
index 0000000000..8ffc24eaab
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes an error during a provider callback
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProviderException extends TuscanyException {
+
+ public ProviderException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactory.java b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactory.java
new file mode 100644
index 0000000000..9422a96cdd
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactory.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Responsible for instantiating a DataSource provider class and initializing the actual <code>DataSource</code> . It
+ * must have a no-args constructor and may optionally implement {@link DataSourceProvider}. If it does not implement
+ * <code>DataSourceProvider</code>, then the provider class must implement the <code>DataSource<code> interface. A
+ * collection of {@link Injector}s is used to inject the provider instance with configuration parameters.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProviderObjectFactory implements ObjectFactory<DataSource> {
+ private Class<?> providerClass;
+ private List<Injector> injectors;
+
+ public ProviderObjectFactory(Class<?> providerClass, List<Injector> injectors) {
+ assert providerClass != null;
+ assert injectors != null;
+ this.providerClass = providerClass;
+ this.injectors = injectors;
+ }
+
+ public DataSource getInstance() throws ObjectCreationException {
+ try {
+ Object instance = providerClass.newInstance();
+ for (Injector injector : injectors) {
+ injector.inject(instance);
+ }
+ if (instance instanceof DataSourceProvider) {
+ DataSourceProvider dataSourceProvider = (DataSourceProvider) instance;
+ try {
+ dataSourceProvider.init();
+ return dataSourceProvider.getDataSource();
+ } catch (ProviderException e) {
+ throw new ObjectCreationException(e);
+ }
+ } else {
+ return (DataSource) instance;
+ }
+ } catch (InstantiationException e) {
+ throw new ObjectCreationException(e);
+ } catch (IllegalAccessException e) {
+ throw new ObjectCreationException(e);
+ } catch (InvocationTargetException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/main/resources/META-INF/sca/dataSource.scdl b/sandbox/old/contrib/persistence/datasource/src/main/resources/META-INF/sca/dataSource.scdl
new file mode 100644
index 0000000000..df0375b2dc
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/main/resources/META-INF/sca/dataSource.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Configuration for DataSource support.
+
+ $Rev: 440909 $ $Date: 2006-09-06 17:07:19 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.persistence.datasource"
+ autowire="true">
+
+ <component name="datasource.dataSourceBuilder">
+ <system:implementation.system class="org.apache.tuscany.persistence.datasource.DataSourceBuilder"/>
+ </component>
+ <component name="datasource.dsComponentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.persistence.datasource.DSComponentTypeLoader"/>
+ </component>
+ <component name="datasource.datasourceLoader">
+ <system:implementation.system class="org.apache.tuscany.persistence.datasource.DataSourceImplementationLoader"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoaderTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoaderTestCase.java
new file mode 100644
index 0000000000..87c12db9bf
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoaderTestCase.java
@@ -0,0 +1,88 @@
+package org.apache.tuscany.persistence.datasource;
+
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.model.ComponentType;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DSComponentTypeLoaderTestCase extends TestCase {
+
+ public void testIntrospection() throws Exception {
+ DSComponentTypeLoader loader = new DSComponentTypeLoader(null);
+ DataSourceImplementation implementation = new DataSourceImplementation();
+ implementation.setProviderName(Foo.class.getName());
+ implementation.setClassLoader(getClass().getClassLoader());
+ loader.load(implementation, null);
+ ComponentType<?, ?, ?> type = implementation.getComponentType();
+ assertEquals(2, type.getProperties().size());
+ assertNull(type.getProperties().get("object"));
+ Object bar = type.getProperties().get("bar");
+ assertEquals(String.class, ((JavaMappedProperty) bar).getJavaType());
+ Object baz = type.getProperties().get("baz");
+ assertEquals(Integer.TYPE, ((JavaMappedProperty) baz).getJavaType());
+ assertEquals(1, type.getServices().size());
+ assertEquals(DataSource.class, type.getServices().get("DataSource").getServiceContract().getInterfaceClass());
+ }
+
+
+ public void testOverloadedMethod() throws Exception {
+ DSComponentTypeLoader loader = new DSComponentTypeLoader(null);
+ DataSourceImplementation implementation = new DataSourceImplementation();
+ implementation.setProviderName(BadFoo.class.getName());
+ implementation.setClassLoader(getClass().getClassLoader());
+ try {
+ loader.load(implementation, null);
+ fail();
+ } catch (AmbiguousPropertyException e) {
+ // expected
+ }
+ }
+
+ public class Foo {
+
+ private String bar;
+
+ private int baz;
+
+ private Foo object;
+
+ public String getBar() {
+ return bar;
+ }
+
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+
+ public int getBaz() {
+ return baz;
+ }
+
+ public void setBaz(int baz) {
+ this.baz = baz;
+ }
+
+ public Foo getObject() {
+ return object;
+ }
+
+ public void setObject(Foo object) {
+ this.object = object;
+ }
+ }
+
+ public class BadFoo {
+
+ public void setBar(String bar) {
+ }
+
+ public void setBar(Object bar) {
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceBuilderTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceBuilderTestCase.java
new file mode 100644
index 0000000000..c7daaa6e4d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceBuilderTestCase.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.net.URI;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataSourceBuilderTestCase extends TestCase {
+
+ public void testBuild() throws Exception {
+ ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
+ EasyMock.replay(scope);
+ DeploymentContext ctx = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.replay(ctx);
+
+ DataSourceImplementation implementation = new DataSourceImplementation();
+ ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> componentType =
+ new ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();
+ JavaServiceContract serviceContract = new JavaServiceContract(DataSource.class);
+ ServiceDefinition service = new ServiceDefinition(URI.create("DataSource"), serviceContract, false);
+ componentType.add(service);
+ componentType.setInitLevel(1);
+ implementation.setComponentType(componentType);
+ implementation.setProviderName(MockProvider.class.getName());
+ implementation.setClassLoader(getClass().getClassLoader());
+
+ ComponentDefinition<DataSourceImplementation> def =
+ new ComponentDefinition<DataSourceImplementation>(URI.create("MyDS"), implementation);
+
+ DataSourceBuilder builder = new DataSourceBuilder();
+
+ DataSourceComponent component = (DataSourceComponent) builder.build(def, ctx);
+ assertEquals(URI.create("MyDS"), component.getUri());
+
+ DataSource ds = (DataSource) component.createInstance();
+ assertNotNull(ds);
+ EasyMock.verify(ctx);
+ EasyMock.verify(scope);
+ }
+
+ private static class MockProvider implements DataSourceProvider {
+
+ public MockProvider() {
+ }
+
+ public void init() throws ProviderException {
+
+ }
+
+ public void close() throws ProviderException {
+
+ }
+
+ public DataSource getDataSource() throws ProviderException {
+ return EasyMock.createNiceMock(DataSource.class);
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
new file mode 100644
index 0000000000..e95c1c4123
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataSourceComponentTestCase extends TestCase {
+
+ public void testDestroy() throws Exception {
+ DataSourceProvider provider = EasyMock.createMock(DataSourceProvider.class);
+ provider.close();
+ EasyMock.replay(provider);
+ DataSourceComponent component = new DataSourceComponent(URI.create("ds"), null, 0);
+ component.destroy(provider);
+ EasyMock.verify(provider);
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoaderTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..49c83bacc7
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceImplementationLoaderTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataSourceImplementationLoaderTestCase extends TestCase {
+
+ public void testLoadingNoParameters() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ DataSourceImplementationLoader loader = new DataSourceImplementationLoader(registry);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getAttributeValue(null, "provider")).andReturn("org.foo.MyDriver");
+ EasyMock.expect(reader.next()).andReturn(END_ELEMENT);
+ EasyMock.replay(reader);
+ DeploymentContext ctx = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(ctx.getClassLoader()).andReturn(getClass().getClassLoader());
+ EasyMock.replay(ctx);
+ DataSourceImplementation implementation = (DataSourceImplementation) loader.load(null, reader, ctx);
+ assertEquals("org.foo.MyDriver", implementation.getProviderName());
+ assertEquals(getClass().getClassLoader(), implementation.getClassLoader());
+ EasyMock.verify(reader);
+ EasyMock.verify(ctx);
+ }
+
+ public void testNoDriverName() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ DataSourceImplementationLoader loader = new DataSourceImplementationLoader(registry);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getAttributeValue(null, "provider")).andReturn(null);
+ EasyMock.replay(reader);
+ try {
+ loader.load(null, reader, null);
+ fail();
+ } catch (LoaderException e) {
+ // expected
+ }
+ EasyMock.verify(reader);
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/InjectorTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/InjectorTestCase.java
new file mode 100644
index 0000000000..8d5a6f06a4
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/InjectorTestCase.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InjectorTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testInject() throws Exception {
+ Method m = Foo.class.getMethod("setVal", String.class);
+ ObjectFactory factory = EasyMock.createMock(ObjectFactory.class);
+ EasyMock.expect(factory.getInstance()).andReturn("foo");
+ EasyMock.replay(factory);
+ Injector injector = new Injector(m, factory);
+ Foo foo = new Foo();
+ injector.inject(foo);
+ assertEquals("foo", foo.val);
+ EasyMock.verify(factory);
+ }
+
+ private class Foo {
+ private String val;
+
+ public void setVal(String val) {
+ this.val = val;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactoryTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactoryTestCase.java
new file mode 100644
index 0000000000..d335dcc4d1
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/ProviderObjectFactoryTestCase.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource;
+
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ProviderObjectFactoryTestCase extends TestCase {
+
+ public void testInstantiation() throws Exception {
+ List<Injector> injectors = new ArrayList<Injector>();
+ Method m = Provider.class.getMethod("setVal", Integer.TYPE);
+ injectors.add(new Injector(m, new MockFactory(1)));
+ ProviderObjectFactory factory = new ProviderObjectFactory(Provider.class, injectors);
+ DataSource ds = factory.getInstance();
+ Provider provider = (Provider) ds;
+ assertEquals(1, provider.getVal());
+ }
+
+ public void testInitInstantiation() throws Exception {
+ List<Injector> injectors = new ArrayList<Injector>();
+ Method m = DSProvider.class.getMethod("setVal", Integer.TYPE);
+ injectors.add(new Injector(m, new MockFactory(1)));
+ ProviderObjectFactory factory = new ProviderObjectFactory(DSProvider.class, injectors);
+ assertNotNull(factory.getInstance());
+
+ }
+
+ public static class Provider implements DataSource {
+ private int val;
+
+ public Provider() {
+ }
+
+ public int getVal() {
+ return val;
+ }
+
+ public void setVal(int val) {
+ this.val = val;
+ }
+
+ public Connection getConnection() throws SQLException {
+ return null;
+ }
+
+ public Connection getConnection(String username, String password) throws SQLException {
+ return null;
+ }
+
+ public PrintWriter getLogWriter() throws SQLException {
+ return null;
+ }
+
+ public void setLogWriter(PrintWriter out) throws SQLException {
+
+ }
+
+ public void setLoginTimeout(int seconds) throws SQLException {
+
+ }
+
+ public int getLoginTimeout() throws SQLException {
+ return 0;
+ }
+ }
+
+ public static class DSProvider implements DataSourceProvider {
+ private int val;
+ private boolean initialized;
+
+ public DSProvider() {
+ }
+
+ public int getVal() {
+ return val;
+ }
+
+ public void setVal(int val) {
+ this.val = val;
+ }
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ public void init() {
+ if (val != 1) {
+ fail();
+ }
+ initialized = true;
+ }
+
+
+ public void close() {
+
+ }
+
+ public DataSource getDataSource() throws ProviderException {
+ if (!initialized) {
+ fail();
+ }
+ return EasyMock.createNiceMock(DataSource.class);
+ }
+ }
+
+ private class MockFactory implements ObjectFactory<Integer> {
+ private Integer instance;
+
+ public MockFactory(Integer instance) {
+ this.instance = instance;
+ }
+
+ public Integer getInstance() throws ObjectCreationException {
+ return instance;
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java
new file mode 100644
index 0000000000..a94ab25f3b
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource.integration;
+
+import java.net.URL;
+import java.sql.Connection;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+
+import junit.framework.TestCase;
+
+/**
+ * Verifies bootstrapping of a datasource implementation using Commons DBCP and HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class DHCPBootstrapTestCase extends TestCase {
+
+ public void testBasicConnection() throws Exception {
+// DataSource ds = (DataSource) ((AtomicComponent) component.getSystemChild("TestDS")).getTargetInstance();
+// assertNotNull(ds);
+// Connection conn = ds.getConnection();
+// conn.createStatement().execute("CREATE TABLE foo (bar char(20));");
+ }
+
+ protected void setUp() throws Exception {
+// URL url = getClass().getResource("/META-INF/sca/dataSource.scdl");
+// addExtension("DataSourceExtension", url);
+// setApplicationSCDL(getClass().getResource("/META-INF/sca/dbcp.scdl"));
+// super.setUp();
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java
new file mode 100644
index 0000000000..23dab05e65
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource.integration;
+
+import java.net.URL;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+
+import org.apache.tuscany.persistence.datasource.integration.mock.Provider;
+import junit.framework.TestCase;
+
+/**
+ * Verifies bootstrapping of a datasource implementation as a system service in an application composite using a mock
+ * Provider
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProviderBootstrapTestCase extends TestCase {
+
+ public void testBoot() throws Exception {
+// DataSource ds = (DataSource) ((AtomicComponent)component.getSystemChild("TestDS")).getTargetInstance();
+// assertNotNull(ds);
+// assertEquals("value", ((Provider) ds).getTest());
+ }
+
+ protected void setUp() throws Exception {
+// URL url = getClass().getResource("/META-INF/sca/dataSource.scdl");
+// addExtension("DataSourceExtension", url);
+// setApplicationSCDL(getClass().getResource("/META-INF/sca/provider.scdl"));
+ super.setUp();
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/mock/Provider.java b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/mock/Provider.java
new file mode 100644
index 0000000000..558b73e700
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/mock/Provider.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.datasource.integration.mock;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.io.PrintWriter;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.persistence.datasource.DataSourceProvider;
+import org.apache.tuscany.persistence.datasource.ProviderException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Provider implements DataSourceProvider, DataSource {
+
+ private String test;
+
+ public void setTest(String test) {
+ this.test = test;
+ }
+
+ public String getTest() {
+ return test;
+ }
+
+ public void init() throws ProviderException {
+
+ }
+
+ public void close() throws ProviderException {
+
+ }
+
+ public DataSource getDataSource() throws ProviderException {
+ return this;
+ }
+
+ public Connection getConnection() throws SQLException {
+ return null;
+ }
+
+ public Connection getConnection(String username, String password) throws SQLException {
+ return null;
+ }
+
+ public PrintWriter getLogWriter() throws SQLException {
+ return null;
+ }
+
+ public void setLogWriter(PrintWriter out) throws SQLException {
+
+ }
+
+ public void setLoginTimeout(int seconds) throws SQLException {
+
+ }
+
+ public int getLoginTimeout() throws SQLException {
+ return 0;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl b/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl
new file mode 100644
index 0000000000..6cdc7102fa
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="bootTest">
+
+ <component name="TestDS">
+ <system:implementation.ds provider="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="driverClassName">org.hsqldb.jdbcDriver</property>
+ <property name="url">jdbc:hsqldb:mem:testdb</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl b/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl
new file mode 100644
index 0000000000..0dc4c866b1
--- /dev/null
+++ b/sandbox/old/contrib/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="bootTest">
+
+ <component name="TestDS">
+ <system:implementation.ds provider="org.apache.tuscany.persistence.datasource.integration.mock.Provider"/>
+ <property name="test">value</property>
+ <property name="loginTimeout">1</property>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/persistence/openjpa/.ruleset b/sandbox/old/contrib/persistence/openjpa/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/persistence/openjpa/LICENSE.txt b/sandbox/old/contrib/persistence/openjpa/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/persistence/openjpa/NOTICE.txt b/sandbox/old/contrib/persistence/openjpa/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/persistence/openjpa/pom.xml.off b/sandbox/old/contrib/persistence/openjpa/pom.xml.off
new file mode 100644
index 0000000000..51a429fda3
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/pom.xml.off
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>openjpa</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany OpenJPA</name>
+ <description>TuscanyOpenJPA Integration.</description>
+
+
+ <repositories>
+ <repository>
+ <id>apache-snapshots</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ </repository>
+ </repositories>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ <version>0.9.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/Constants.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/Constants.java
new file mode 100644
index 0000000000..820f57bcad
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/Constants.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+/**
+ * Constants used by the JPA extension
+ *
+ * @version $Rev$ $Date$
+ */
+public final class Constants {
+
+ public static final String PERSISTENCE_UNIT = "persistenceUnit";
+ public static final String CONFIG_PROPERTIES = "configProperties";
+
+ private Constants() {
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryImplementation.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryImplementation.java
new file mode 100644
index 0000000000..d818f145bd
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryImplementation.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import org.apache.tuscany.spi.model.AtomicImplementation;
+import org.apache.tuscany.spi.model.ComponentType;
+
+/**
+ * Represents the implementation type of a system service that manages JPA
+ * <code>EntityManagerFactoryImplementation</code> implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerFactoryImplementation extends AtomicImplementation<ComponentType> {
+
+ public EntityManagerFactoryImplementation() {
+ }
+
+ public EntityManagerFactoryImplementation(ComponentType componentType) {
+ super(componentType);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryNotConfiguredException.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryNotConfiguredException.java
new file mode 100644
index 0000000000..34e69b8951
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerFactoryNotConfiguredException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerFactoryNotConfiguredException extends ProcessingException {
+
+ public EntityManagerFactoryNotConfiguredException() {
+ super("Entity manager factory not configured");
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerObjectFactory.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerObjectFactory.java
new file mode 100644
index 0000000000..45d4e1a077
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerObjectFactory.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import java.util.Map;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Creates a JPA <code>EntityManager</code> to be injected on a component implementation instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerObjectFactory implements ObjectFactory<EntityManager> {
+
+ private EntityManagerFactory emf;
+ private Map props;
+
+ public EntityManagerObjectFactory(EntityManagerFactory emf) {
+ this.emf = emf;
+ }
+
+ public EntityManagerObjectFactory(EntityManagerFactory emf, Map props) {
+ this.emf = emf;
+ this.props = props;
+ }
+
+ public EntityManager getInstance() throws ObjectCreationException {
+ if (props == null) {
+ return emf.createEntityManager();
+ } else {
+ return emf.createEntityManager(props);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerProcessor.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerProcessor.java
new file mode 100644
index 0000000000..8046c0a7c0
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/EntityManagerProcessor.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import java.lang.reflect.Member;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.AbstractPropertyProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+
+/**
+ * Evaluates constructors, methods, and fields annotated with {@link PersistenceContext }, creating a mapped property
+ * that will inject an {@link EntityManager} on an implementation instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerProcessor extends AbstractPropertyProcessor<PersistenceContext> {
+
+ public EntityManagerProcessor(@Autowire ImplementationProcessorService service) {
+ super(PersistenceContext.class, service);
+ }
+
+ protected String getName(PersistenceContext annotation) {
+ String name = annotation.unitName();
+ if (name == null) {
+ return "_defaultJPAPersistenceUnit";
+ }
+ return name;
+ }
+
+ protected <T> JavaMappedProperty<T> createProperty(String name,
+ Class<T> javaType,
+ Member member) throws ProcessingException {
+ if (!EntityManager.class.equals(javaType)) {
+ throw new InvalidInjectionSite("Injection site must by of type " + EntityManager.class.getName(), name);
+ }
+ return super.createProperty(name, javaType, member);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ PersistenceContext annotation,
+ CompositeComponent parent,
+ DeploymentContext context) throws ProcessingException {
+ EntityManagerFactory emf;
+ try {
+ InboundWire wire = parent.resolveSystemAutowire(EntityManagerFactory.class);
+ if (wire == null) {
+ throw new EntityManagerFactoryNotConfiguredException();
+ }
+ Object o = wire.getTargetService();
+ assert o instanceof EntityManagerFactory;
+ emf = (EntityManagerFactory) o;
+ } catch (TargetException e) {
+ throw new ProcessingException(e);
+ }
+ ObjectFactory factory = new EntityManagerObjectFactory(emf);
+ property.setDefaultValueFactory(factory);
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/InvalidInjectionSite.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/InvalidInjectionSite.java
new file mode 100644
index 0000000000..0ac5e9ffa1
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/InvalidInjectionSite.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidInjectionSite extends ProcessingException {
+
+ public InvalidInjectionSite(String message) {
+ super(message);
+ }
+
+ public InvalidInjectionSite(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAAtomicComponent.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAAtomicComponent.java
new file mode 100644
index 0000000000..df74625b49
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAAtomicComponent.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import java.util.Map;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.SystemAtomicComponentExtension;
+
+/**
+ * A system service that manages a JPA <code>EntityManagerFactory</code>. This service is used by {@link
+ * EntityManagerProcessor} to inject an <code>EntityManager<code> on a constructor parameter, field, or method of an
+ * implementation instance. Since a JPA persistence context is specific to an application, this system service is scoped
+ * to the application composite. That is, it is contained as a system child of the application composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JPAAtomicComponent extends SystemAtomicComponentExtension {
+ private EntityManagerFactory factory;
+ private String persistenceUnit;
+ private Map<Object, Object> configProps;
+
+ public JPAAtomicComponent(String name,
+ CompositeComponent parent,
+ ScopeContainer scopeContainer,
+ String persistenceUnit,
+ Map<Object, Object> configProps,
+ int initLevel) {
+ super(name, parent, initLevel);
+ assert persistenceUnit != null;
+ this.persistenceUnit = persistenceUnit;
+ this.configProps = configProps;
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ if (configProps != null) {
+ factory = Persistence.createEntityManagerFactory(persistenceUnit, configProps);
+ } else {
+ factory = Persistence.createEntityManagerFactory(persistenceUnit);
+ }
+ return factory;
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return factory;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAComponentBuilder.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAComponentBuilder.java
new file mode 100644
index 0000000000..d979b93ca2
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAComponentBuilder.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+
+import static org.apache.tuscany.service.openjpa.Constants.PERSISTENCE_UNIT;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JPAComponentBuilder extends ComponentBuilderExtension {
+ protected Class getImplementationType() {
+ return null;
+ }
+
+ public Component build(CompositeComponent parent, ComponentDefinition definition, DeploymentContext ctx)
+ throws BuilderConfigException {
+// String name = definition.getName();
+// ScopeContainer moduleScope = ctx.getCompositeScope();
+// Integer initLevel = definition.getInitLevel();
+ ComponentType<?, ?, ?> type = definition.getImplementation().getComponentType();
+ Property<?> persistenceUnit = type.getProperties().get(PERSISTENCE_UNIT);
+ if (persistenceUnit == null) {
+ throw new BuilderConfigException("Persistence Unit not specified in JPA import in composite",
+ parent.getName());
+ }
+// Property<?> configProps = type.getProperties().get(PERSISTENCE_UNIT);
+ return null;
+// return new JPAAtomicComponent(name, parent, moduleScope, initLevel);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAImportLoader.java b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAImportLoader.java
new file mode 100644
index 0000000000..94508e5408
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/main/java/org/apache/tuscany/service/openjpa/JPAImportLoader.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JPAImportLoader extends LoaderExtension {
+ private static final QName IMPORT = new QName(XML_NAMESPACE_1_0, "import.jpa");
+
+ public JPAImportLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPORT;
+ }
+
+ public ModelObject load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ //ComponentDefinition definition = new ComponentDefinition()
+ // TODO read in persisitence unit setting and properties, and set them as properties on the component
+ return null;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/openjpa/src/test/java/org/apache/tuscany/service/openjpa/EntityManagerProcessorTestCase.java b/sandbox/old/contrib/persistence/openjpa/src/test/java/org/apache/tuscany/service/openjpa/EntityManagerProcessorTestCase.java
new file mode 100644
index 0000000000..a32c850e32
--- /dev/null
+++ b/sandbox/old/contrib/persistence/openjpa/src/test/java/org/apache/tuscany/service/openjpa/EntityManagerProcessorTestCase.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.openjpa;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EntityManagerProcessorTestCase extends TestCase {
+
+ private ImplementationProcessor processor;
+ private CompositeComponent parent;
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", EntityManager.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(parent, method, type, null);
+ JavaMappedProperty<?> prop = type.getProperties().get("bar");
+ assertEquals(EntityManagerObjectFactory.class, prop.getDefaultValueFactory().getClass());
+ }
+
+ public void testVisitBadMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBadBar", String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(parent, method, type, null);
+ fail();
+ } catch (InvalidInjectionSite e) {
+ // expected
+ }
+ }
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitField(parent, field, type, null);
+ JavaMappedProperty<?> prop = type.getProperties().get("bar");
+ assertEquals(EntityManagerObjectFactory.class, prop.getDefaultValueFactory().getClass());
+ }
+
+ public void testBadVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("badField");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitField(null, field, type, null);
+ fail();
+ } catch (InvalidInjectionSite e) {
+ // expected
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ EntityManagerFactory emf = EasyMock.createMock(EntityManagerFactory.class);
+ EasyMock.replay(emf);
+
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn(emf);
+ EasyMock.replay(wire);
+
+ parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EntityManagerFactory.class)).andReturn(wire).atLeastOnce();
+ EasyMock.replay(parent);
+ ImplementationProcessorService service = EasyMock.createMock(ImplementationProcessorService.class);
+ service.addName(EasyMock.isA(List.class), EasyMock.eq(0), EasyMock.isA(String.class));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ @SuppressWarnings({"unchecked"})
+ public Object answer() throws Throwable {
+ ((List<Object>) EasyMock.getCurrentArguments()[0]).add(EasyMock.getCurrentArguments()[2]);
+ return null;
+ }
+ });
+ EasyMock.replay(service);
+ processor = new EntityManagerProcessor(service);
+ }
+
+ private static class Foo {
+
+
+ @PersistenceContext
+ protected EntityManager bar;
+
+ @PersistenceContext
+ protected String badField;
+
+ @PersistenceContext
+ public void setBar(EntityManager d) {
+ }
+
+ @PersistenceContext
+ public void setBadBar(String d) {
+ }
+
+ }
+}
diff --git a/sandbox/old/contrib/persistence/pom.xml.off b/sandbox/old/contrib/persistence/pom.xml.off
new file mode 100644
index 0000000000..8ec39069c7
--- /dev/null
+++ b/sandbox/old/contrib/persistence/pom.xml.off
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany SCA Persistence Services</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>common</module>
+ <module>openjpa</module>
+ <module>datasource</module>
+ <module>store.jdbc</module>
+ <module>store.journal</module>
+ </modules>
+</project>
diff --git a/sandbox/old/contrib/persistence/store.jdbc/.ruleset b/sandbox/old/contrib/persistence/store.jdbc/.ruleset
new file mode 100644
index 0000000000..a1547fea92
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/persistence/store.jdbc/LICENSE.txt b/sandbox/old/contrib/persistence/store.jdbc/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/persistence/store.jdbc/NOTICE.txt b/sandbox/old/contrib/persistence/store.jdbc/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/persistence/store.jdbc/pom.xml.off b/sandbox/old/contrib/persistence/store.jdbc/pom.xml.off
new file mode 100644
index 0000000000..99030eb722
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/pom.xml.off
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>persistence-store-jdbc</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JDBC Store</name>
+ <description>Defines a JDBC-based persistent store.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Converter.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Converter.java
new file mode 100644
index 0000000000..b37ae6cbe5
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Converter.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+
+import org.apache.tuscany.spi.services.store.StoreReadException;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+/**
+ * Converters mediate the particularities of specific databases and JDBC drivers such as data types during read and
+ * write operations
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Converter {
+
+ /**
+ * Returns the SQL statement to select a record for update
+ *
+ * @return the SQL statement to select a record for update
+ */
+ String getSelectUpdateSql();
+
+ /**
+ * Returns the SQL statement to add a record
+ *
+ * @return the SQL statement to add a record
+ */
+ String getInsertSql();
+
+ /**
+ * Returns the SQL statement to update a record
+ *
+ * @return the SQL statement to update a record
+ */
+ String getUpdateSql();
+
+ /**
+ * Returns the SQL statement to retrieve a record
+ *
+ * @return the SQL statement to retrieve a record
+ */
+ String getFindSql();
+
+ /**
+ * Returns the SQL statement to remove a record
+ *
+ * @return the SQL statement to remove a record
+ */
+ String getDeleteSql();
+
+ /**
+ * Returns the SQL statement to remove expired records
+ *
+ * @return the SQL statement to remove expired records
+ */
+ String getDeleteExpiredSql();
+
+ String getDeleteRecordSql();
+
+ /**
+ * Writes a new record to the underlying store using batch semantics. That is, the insert will be added as a batch
+ * operation to the prepared statment. It is the responsibility of the client (i.e. the prepared statement "owner")
+ * to exectute the statement when the batch threshold is reached. Note implementations must assume auto commit is
+ * false.
+ *
+ * @param stmt
+ * @param ownerId
+ * @param id
+ * @param expiration
+ * @param object
+ * @throws org.apache.tuscany.spi.services.store.StoreWriteException
+ *
+ */
+ void insert(PreparedStatement stmt, String ownerId, String id, long expiration, Serializable object)
+ throws StoreWriteException;
+
+ /**
+ * @param stmt
+ * @param ownerId
+ * @param id
+ * @param object
+ * @throws StoreWriteException
+ */
+ void update(PreparedStatement stmt, String ownerId, String id, Serializable object) throws StoreWriteException;
+
+ /**
+ * @param stmt
+ * @param ownerId
+ * @param id
+ * @return
+ * @throws StoreWriteException
+ */
+ boolean findAndLock(PreparedStatement stmt, String ownerId, String id) throws StoreWriteException;
+
+ /**
+ * Reads a record from the underlying store. Note implementations must assume auto commit is false.
+ *
+ * @param conn
+ * @param ownerId
+ * @param id
+ * @return
+ * @throws StoreReadException
+ */
+ Object read(Connection conn, String ownerId, String id) throws StoreReadException;
+
+ /**
+ * @param stmt
+ * @param ownerId
+ * @param id
+ * @throws StoreWriteException
+ */
+ void delete(PreparedStatement stmt, String ownerId, String id) throws StoreWriteException;
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
new file mode 100644
index 0000000000..5bd04e98da
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStore.java
@@ -0,0 +1,347 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import javax.sql.DataSource;
+
+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.Resource;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.AbstractEventPublisher;
+import org.apache.tuscany.spi.services.store.RecoveryListener;
+import org.apache.tuscany.spi.services.store.Store;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+import org.apache.tuscany.spi.services.store.StoreReadException;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.api.annotation.Monitor;
+
+/**
+ * A store implementation that uses a relational database to persist records transactionally.
+ * <p/>
+ * Note this implementation does not yet support destruction callbacks for expired. In order to support this, expired
+ * records must be rehydrated and deleted individually.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Store.class)
+@EagerInit
+public class JDBCStore extends AbstractEventPublisher implements Store {
+ private DataSource dataSource;
+ private StoreMonitor monitor;
+ private Converter converter;
+ // TODO integrate with a core threading scheme
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private ScheduledExecutorService scheduler;
+ private long reaperInterval = 300000;
+ private long defaultExpirationOffset = 600000; // 10 minutes
+
+ //private
+ public JDBCStore(@Resource(mappedName = "StoreDS")DataSource dataSource,
+ @Autowire Converter converter,
+ @Monitor StoreMonitor monitor) {
+ this.dataSource = dataSource;
+ this.converter = converter;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Returns the maximum default expiration offset for records in the store
+ *
+ * @return the maximum default expiration offset for records in the store
+ */
+ @Property
+ public long getExpirationOffset() {
+ return defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the maximum default expiration offset for records in the store
+ */
+ 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;
+ }
+
+ /**
+ * Returns the interval for expired entry scanning to be performed
+ */
+ public long getReaperInterval() {
+ return reaperInterval;
+ }
+
+ @Init
+ public void init() {
+ this.scheduler = Executors.newSingleThreadScheduledExecutor();
+ scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS);
+ monitor.start("JDBC store started");
+ }
+
+ @Destroy
+ public void destroy() {
+ scheduler.shutdown();
+ monitor.stop("JDBC store stopped");
+ }
+
+ public void insertRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ if (!(object instanceof Serializable)) {
+ throw new NonSerializableTypeException("Type must implement serializable", owner.getCanonicalName(), id);
+ }
+ Serializable serializable = (Serializable) object;
+ String canonicalName = owner.getCanonicalName();
+ Connection conn = null;
+ PreparedStatement insertStmt = null;
+ PreparedStatement updateStmt = null;
+ long now = System.currentTimeMillis();
+ try {
+ conn = dataSource.getConnection();
+ if (now < expiration || expiration == NEVER) {
+ PreparedStatement stmt = conn.prepareStatement(converter.getSelectUpdateSql());
+ if (converter.findAndLock(stmt, canonicalName, id)) {
+ updateStmt = conn.prepareStatement(converter.getUpdateSql());
+ converter.update(updateStmt, canonicalName, id, serializable);
+ } else {
+ insertStmt = conn.prepareStatement(converter.getInsertSql());
+ converter.insert(insertStmt, canonicalName, id, expiration, serializable);
+ }
+ }
+ try {
+ if (insertStmt != null) {
+ insertStmt.executeUpdate();
+ }
+ if (updateStmt != null) {
+ updateStmt.executeUpdate();
+ }
+ conn.commit();
+ } catch (SQLException e) {
+ try {
+ conn.rollback();
+ } catch (SQLException e2) {
+ monitor.error(e2);
+ }
+ throw new StoreWriteException(owner.getCanonicalName(), id, e);
+ }
+ } catch (SQLException e) {
+ throw new StoreWriteException(owner.getCanonicalName(), id, e);
+ } finally {
+ close(insertStmt);
+ close(updateStmt);
+ close(conn);
+ }
+ }
+
+ public void updateRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ if (!(object instanceof Serializable)) {
+ throw new NonSerializableTypeException("Type must implement serializable", owner.getCanonicalName(), id);
+ }
+ Serializable serializable = (Serializable) object;
+ String canonicalName = owner.getCanonicalName();
+ Connection conn = null;
+ PreparedStatement insertStmt = null;
+ PreparedStatement updateStmt = null;
+ try {
+ conn = dataSource.getConnection();
+ conn = dataSource.getConnection();
+ conn.setAutoCommit(false);
+ updateStmt = conn.prepareStatement(converter.getUpdateSql());
+ converter.update(updateStmt, canonicalName, id, serializable);
+ try {
+ if (updateStmt != null) {
+ updateStmt.executeUpdate();
+ }
+ conn.commit();
+ } catch (SQLException e) {
+ try {
+ conn.rollback();
+ } catch (SQLException e2) {
+ monitor.error(e2);
+ }
+ throw new StoreWriteException(owner.getCanonicalName(), id, e);
+ }
+ } catch (SQLException e) {
+ throw new StoreWriteException(owner.getCanonicalName(), id, e);
+ } finally {
+ close(insertStmt);
+ close(updateStmt);
+ close(conn);
+ }
+
+ }
+
+ public Object readRecord(SCAObject owner, String id) throws StoreReadException {
+ Connection conn = null;
+ try {
+ conn = dataSource.getConnection();
+ Object object = converter.read(conn, owner.getCanonicalName(), id);
+ conn.commit();
+ return object;
+ } catch (SQLException e) {
+ try {
+ if (conn != null) {
+ conn.rollback();
+ }
+ } catch (SQLException e2) {
+ monitor.error(e2);
+ }
+ throw new StoreReadException(owner.getName(), id, e);
+ } finally {
+ close(conn);
+ }
+ }
+
+ public void removeRecord(SCAObject owner, String id) throws StoreWriteException {
+ Connection conn = null;
+ try {
+ conn = dataSource.getConnection();
+ PreparedStatement stmt = conn.prepareStatement(converter.getDeleteRecordSql());
+ converter.delete(stmt, owner.getCanonicalName(), id);
+ stmt.executeUpdate();
+ conn.commit();
+ } catch (SQLException e) {
+ try {
+ if (conn != null) {
+ conn.rollback();
+ }
+ } catch (SQLException e2) {
+ monitor.error(e2);
+ }
+ throw new StoreWriteException(owner.getCanonicalName(), id, e);
+ } finally {
+ close(conn);
+ }
+ }
+
+ public void removeRecords() throws StoreWriteException {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ try {
+ conn = dataSource.getConnection();
+ stmt = conn.prepareStatement(converter.getDeleteSql());
+ stmt.executeUpdate();
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ } finally {
+ close(stmt, conn);
+ }
+ }
+
+ public void recover(RecoveryListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void close(Connection conn) {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ monitor.error(e);
+ }
+ }
+ }
+
+ private void close(PreparedStatement stmt) {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ monitor.error(e);
+ }
+ }
+ }
+
+ private void close(PreparedStatement stmt, Connection conn) {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ monitor.error(e);
+ }
+ }
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ monitor.error(e);
+ }
+ }
+ }
+
+ /**
+ * Inner class responsible for clearing out expired entries
+ */
+ private class Reaper implements Runnable {
+ public void run() {
+ long now = System.currentTimeMillis();
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ try {
+ conn = dataSource.getConnection();
+ stmt = conn.prepareStatement(converter.getDeleteExpiredSql());
+ stmt.setLong(1, now);
+ stmt.executeUpdate();
+ conn.commit();
+ } catch (SQLException e) {
+ if (conn != null) {
+ try {
+ conn.rollback();
+ } catch (SQLException e1) {
+ // ignore
+ }
+ }
+ monitor.error(e);
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ // ingnore
+ }
+ }
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/NonSerializableTypeException.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/NonSerializableTypeException.java
new file mode 100644
index 0000000000..75fdde42d0
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/NonSerializableTypeException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NonSerializableTypeException extends StoreWriteException {
+
+ public NonSerializableTypeException(String message, String owner, String identifier) {
+ super(message, owner, identifier);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Record.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Record.java
new file mode 100644
index 0000000000..e568481e17
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/Record.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+
+/**
+ * Represents a persistent object and its metadata.
+ * <p/>
+ * Note this class has a natural ordering that is inconsistent with equals.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Record implements Comparable {
+ public static final int INSERT = 0;
+ public static final int UPDATE = 1;
+
+ private String ownerId;
+ private String id;
+ private Serializable object;
+ private long expiration = JDBCStore.NEVER;
+ private int operation;
+
+ /**
+ * Creates a new record
+ *
+ * @param ownerId
+ * @param id the unique id of the record
+ * @param object the object to serialize
+ * @param expiration the expirary time, {@link org.apache.tuscany.spi.services.store.Store.NEVER} if there is no
+ * expiration
+ * @param operation an <code>INSERT</code> or <code>UPDATE</code> operation
+ */
+ public Record(String ownerId, String id, Serializable object, long expiration, int operation) {
+ this.id = id;
+ this.object = object;
+ this.expiration = expiration;
+ this.operation = operation;
+ this.ownerId = ownerId;
+ }
+
+ /**
+ * Returns the unique object id
+ *
+ * @return the unique object id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the object
+ *
+ * @return the object
+ */
+ public Serializable getObject() {
+ return object;
+ }
+
+ /**
+ * Sets the object to serialize
+ *
+ * @param object the object
+ */
+ public void setObject(Serializable object) {
+ this.object = object;
+ }
+
+ /**
+ * Returns the expiration time
+ *
+ * @return the expiration time
+ */
+ public long getExpiration() {
+ return expiration;
+ }
+
+ /**
+ * Returns the type of operation
+ *
+ * @return the type of operation
+ */
+ public int getOperation() {
+ return operation;
+ }
+
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ public int compareTo(Object o) {
+ assert o instanceof Record;
+ Record record = (Record) o;
+ if (record.getOperation() == operation) {
+ return 0;
+ } else if (record.getOperation() == INSERT) {
+ return 1;
+ } else if (record.getOperation() == UPDATE) {
+ return -1;
+ } else {
+ throw new AssertionError();
+ }
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/TCCLObjectInputStream.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/TCCLObjectInputStream.java
new file mode 100644
index 0000000000..1cd18c1b24
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/TCCLObjectInputStream.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * Deserializes an object based on the thread context classloader
+ *
+ * @version $Rev$ $Date$
+ */
+public class TCCLObjectInputStream extends ObjectInputStream {
+ private final ClassLoader classLoader;
+
+ public TCCLObjectInputStream(InputStream in) throws IOException, SecurityException {
+ super(in);
+ this.classLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ protected Class resolveClass(ObjectStreamClass streamClass) throws IOException, ClassNotFoundException {
+ return classLoader.loadClass(streamClass.getName());
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverter.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverter.java
new file mode 100644
index 0000000000..1419c5a9fe
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverter.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.converter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.service.persistence.store.jdbc.Converter;
+import org.apache.tuscany.service.persistence.store.jdbc.TCCLObjectInputStream;
+
+/**
+ * Base class for <code>Converter</code> implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractConverter implements Converter {
+ public static final int OWNER = 1;
+ public static final int ID = 2;
+ public static final int EXPIRATION = 3;
+ public static final int DATA = 4;
+ public static final int OBJECT_UPDATE = 1;
+ public static final int OWNER_UPDATE = 2;
+ public static final int ID_UPDATE = 3;
+
+ protected String findSql = "SELECT * FROM CONVERSATION_STATE WHERE OWNER = ? AND ID = ?";
+ protected String insertSql =
+ "INSERT INTO CONVERSATION_STATE (OWNER, ID, EXPIRATION, OBJECT) VALUES (?, ?, ?, ?)";
+ protected String updateSql = "UPDATE CONVERSATION_STATE SET OBJECT = ? WHERE OWNER = ? AND ID = ?";
+ protected String selectUpdateSql =
+ "SELECT ID FROM CONVERSATION_STATE WHERE OWNER = ? AND ID = ? FOR UPDATE";
+ protected String deleteSql = "DELETE FROM CONVERSATION_STATE WHERE ID = ?";
+ protected String deleteExpiredSql = "DELETE FROM CONVERSATION_STATE WHERE EXPIRATION <= ?";
+ protected String deleteRecordSql = "DELETE FROM CONVERSATION_STATE WHERE OWNER = ? AND ID = ?";
+
+ public String getInsertSql() {
+ return insertSql;
+ }
+
+ public String getUpdateSql() {
+ return updateSql;
+ }
+
+ public String getFindSql() {
+ return findSql;
+ }
+
+ public String getDeleteSql() {
+ return deleteSql;
+ }
+
+ public String getDeleteExpiredSql() {
+ return deleteExpiredSql;
+ }
+
+ public String getSelectUpdateSql() {
+ return selectUpdateSql;
+ }
+
+ public String getDeleteRecordSql() {
+ return deleteRecordSql;
+ }
+
+ public boolean findAndLock(PreparedStatement stmt, String ownerId, String id)
+ throws StoreWriteException {
+ try {
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ return stmt.executeQuery().next();
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ public void delete(PreparedStatement stmt, String ownerId, String id) throws StoreWriteException {
+ try {
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ protected byte[] serialize(Serializable serializable) throws IOException {
+ ByteArrayOutputStream bas = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bas);
+ out.writeObject(serializable);
+ return bas.toByteArray();
+ }
+
+ protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+ return new TCCLObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverter.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverter.java
new file mode 100644
index 0000000000..a85ab5abfa
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverter.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.converter;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.tuscany.spi.services.store.StoreReadException;
+
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+/**
+ * Performs writing and reading operations to HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class HSQLDBConverter extends AbstractConverter {
+
+ // HSQLDB does not support SELECT FOR UPDATE
+ protected String selectUpdateSql = "SELECT ID FROM CONVERSATION_STATE WHERE OWNER = ? AND ID = ?";
+
+ public String getSelectUpdateSql() {
+ return selectUpdateSql;
+ }
+
+ public void insert(PreparedStatement stmt, String ownerId, String id, long expiration, Serializable object)
+ throws StoreWriteException {
+ try {
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ stmt.setLong(EXPIRATION, expiration);
+ stmt.setBytes(DATA, serialize(object));
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ public void update(PreparedStatement stmt, String ownerId, String id, Serializable object)
+ throws StoreWriteException {
+ try {
+ stmt.setBytes(OBJECT_UPDATE, serialize(object));
+ stmt.setString(OWNER_UPDATE, ownerId);
+ stmt.setString(ID_UPDATE, id);
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ public Object read(Connection conn, String ownerId, String id) throws StoreReadException {
+ PreparedStatement stmt = null;
+ try {
+ stmt = conn.prepareStatement(findSql);
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ ResultSet rs = stmt.executeQuery();
+ boolean more = rs.next();
+ if (!more) {
+ return null;
+ }
+ return deserialize(rs.getBytes(DATA));
+ } catch (SQLException e) {
+ throw new StoreReadException(e);
+ } catch (IOException e) {
+ throw new StoreReadException(e);
+ } catch (ClassNotFoundException e) {
+ throw new StoreReadException(e);
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/JDBCConverter.java b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/JDBCConverter.java
new file mode 100644
index 0000000000..4ab9ed6749
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/main/java/org/apache/tuscany/service/persistence/store/jdbc/converter/JDBCConverter.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.converter;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.sql.Blob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.tuscany.spi.services.store.StoreReadException;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+/**
+ * Performs writing and reading operations to a JDBC driver/database combination that supports Blobs
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDBCConverter extends AbstractConverter {
+
+ public void insert(PreparedStatement stmt, String ownerId, String id, long expiration, Serializable object)
+ throws StoreWriteException {
+ try {
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ stmt.setLong(EXPIRATION, expiration);
+ byte[] data = serialize(object);
+ InputStream in = new ByteArrayInputStream(data);
+ stmt.setBinaryStream(DATA, in, data.length);
+ } catch (SQLException e) {
+ throw new StoreWriteException(e);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ public void update(PreparedStatement stmt, String ownerId, String id, Serializable object)
+ throws StoreWriteException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object read(Connection conn, String ownerId, String id) throws StoreReadException {
+ PreparedStatement stmt = null;
+ try {
+ stmt = conn.prepareStatement(findSql);
+ stmt.setString(OWNER, ownerId);
+ stmt.setString(ID, id);
+ ResultSet rs = stmt.executeQuery();
+ rs.next();
+ Blob blob = rs.getBlob(DATA);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
+ int b;
+ byte[] buffer = new byte[1024];
+ while ((b = in.read(buffer, 0, 1024)) != -1) {
+ out.write(buffer, 0, b);
+ }
+ return deserialize(out.toByteArray());
+ } catch (SQLException e) {
+ throw new StoreReadException(e);
+ } catch (IOException e) {
+ throw new StoreReadException(e);
+ } catch (ClassNotFoundException e) {
+ throw new StoreReadException(e);
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreInsertTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreInsertTestCase.java
new file mode 100644
index 0000000000..3d8afc2e3b
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreInsertTestCase.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.UUID;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.services.store.Store;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import org.apache.tuscany.service.persistence.store.jdbc.converter.AbstractConverter;
+import org.apache.tuscany.service.persistence.store.jdbc.converter.HSQLDBConverter;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies store insert operations using HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDBCStoreInsertTestCase extends TestCase {
+ private DataSource ds;
+ private JDBCStore store;
+
+ public void testInsertMetaData() throws Exception {
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ store.init();
+ JDBCStoreInsertTestCase.Foo foo = new JDBCStoreInsertTestCase.Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, Store.NEVER);
+ Statement stmt = ds.getConnection().createStatement();
+ ResultSet rs = stmt.executeQuery(TestUtils.SELECT_SQL);
+ rs.next();
+ assertEquals(id, rs.getString(AbstractConverter.ID));
+ Assert.assertEquals(Store.NEVER, rs.getLong(AbstractConverter.EXPIRATION));
+ }
+
+ public void testInsertRead() throws Exception {
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ JDBCStoreInsertTestCase.Foo foo = new JDBCStoreInsertTestCase.Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, Store.NEVER);
+ Foo foo2 = (Foo) store.readRecord(object, id);
+ assertEquals("test", foo2.data);
+ }
+
+ public void testInsertOverwriteRead() throws Exception {
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ JDBCStoreInsertTestCase.Foo foo = new JDBCStoreInsertTestCase.Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, Store.NEVER);
+ foo.data = "test2";
+ store.insertRecord(object, id, foo, Store.NEVER);
+ Foo foo2 = (Foo) store.readRecord(object, id);
+ assertEquals("test2", foo2.data);
+ }
+
+ /**
+ * Verifies multiple resources belonging to different owners but sharing the same id are inserted
+ */
+ public void testMultipleInsert() throws Exception {
+ SCAObject owner1 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner1.getCanonicalName()).andReturn("baz").atLeastOnce();
+ EasyMock.replay(owner1);
+ SCAObject owner2 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner2.getCanonicalName()).andReturn("bar").atLeastOnce();
+ EasyMock.replay(owner2);
+ store.init();
+ Foo foo1 = new Foo("test");
+ String id1 = UUID.randomUUID().toString();
+ Foo foo2 = new Foo("test2");
+ store.insertRecord(owner1, id1, foo1, Store.NEVER);
+ store.insertRecord(owner2, id1, foo2, Store.NEVER);
+ Foo retFoo1 = (Foo) store.readRecord(owner1, id1);
+ assertEquals("test", retFoo1.data);
+ Foo retFoo2 = (Foo) store.readRecord(owner2, id1);
+ assertEquals("test2", retFoo2.data);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ds = TestUtils.createTables();
+ store = new JDBCStore(ds, new HSQLDBConverter(), EasyMock.createNiceMock(StoreMonitor.class));
+ }
+
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanup(ds);
+ }
+
+ @SuppressWarnings({"SerializableHasSerializationMethods"})
+ public static class Foo implements Serializable {
+ private static final long serialVersionUID = -4284779882741318884L;
+ private String data;
+
+ public Foo(String data) {
+ this.data = data;
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreTestCase.java
new file mode 100644
index 0000000000..418899be86
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreTestCase.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+import java.util.UUID;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.SCAObject;
+
+import junit.framework.TestCase;
+import static org.apache.tuscany.spi.services.store.Store.NEVER;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+import org.apache.tuscany.service.persistence.store.jdbc.converter.HSQLDBConverter;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies store operations using HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDBCStoreTestCase extends TestCase {
+ private DataSource ds;
+ private JDBCStore store;
+
+ public void testNotFound() throws Exception {
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ String id = UUID.randomUUID().toString();
+ assertNull(store.readRecord(object, id));
+ }
+
+ public void testRemoveRecord() throws Exception {
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ Foo foo = new Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, NEVER);
+ Foo foo2 = (Foo) store.readRecord(object, id);
+ assertEquals("test", foo2.data);
+ store.removeRecord(object, id);
+ assertNull(store.readRecord(object, id));
+ }
+
+ public void testExpirationFromStore() throws Exception {
+ store.setReaperInterval(10);
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ Foo foo = new Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, System.currentTimeMillis() + 20);
+ Thread.sleep(100);
+ assertNull(store.readRecord(object, id));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ds = TestUtils.createTables();
+ store = new JDBCStore(ds, new HSQLDBConverter(), EasyMock.createNiceMock(StoreMonitor.class));
+ }
+
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanup(ds);
+ }
+
+ @SuppressWarnings({"SerializableHasSerializationMethods"})
+ public static class Foo implements Serializable {
+ private static final long serialVersionUID = -4284779882741318884L;
+ private String data;
+
+ public Foo(String data) {
+ this.data = data;
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreUpdateTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreUpdateTestCase.java
new file mode 100644
index 0000000000..b9b0500572
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/JDBCStoreUpdateTestCase.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.io.Serializable;
+import java.util.UUID;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.component.SCAObject;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.spi.services.store.Store;
+import static org.apache.tuscany.spi.services.store.Store.NEVER;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+import org.apache.tuscany.service.persistence.store.jdbc.converter.HSQLDBConverter;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies store operations using HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDBCStoreUpdateTestCase extends TestCase {
+ private DataSource ds;
+ private JDBCStore store;
+
+ public void testMultipleUpdate() throws Exception {
+ SCAObject owner1 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner1.getCanonicalName()).andReturn("baz").atLeastOnce();
+ EasyMock.replay(owner1);
+ SCAObject owner2 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner2.getCanonicalName()).andReturn("bar").atLeastOnce();
+ EasyMock.replay(owner2);
+ store.init();
+ Foo foo1 = new Foo("test");
+ String id1 = UUID.randomUUID().toString();
+ Foo foo2 = new Foo("test2");
+ store.insertRecord(owner1, id1, foo1, Store.NEVER);
+ store.insertRecord(owner2, id1, foo2, Store.NEVER);
+ foo1.data = "testA";
+ foo2.data = "test2A";
+ store.updateRecord(owner1, id1, foo1, Store.NEVER);
+ store.updateRecord(owner2, id1, foo2, Store.NEVER);
+ Foo retFoo1 = (Foo) store.readRecord(owner1, id1);
+ assertEquals("testA", retFoo1.data);
+ Foo retFoo2 = (Foo) store.readRecord(owner2, id1);
+ assertEquals("test2A", retFoo2.data);
+ }
+
+ public void testUpdateRead() throws Exception {
+ store.init();
+ SCAObject object = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(object.getCanonicalName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(object);
+ Foo foo = new Foo("test");
+ String id = UUID.randomUUID().toString();
+ store.insertRecord(object, id, foo, NEVER);
+ foo.data = "test2";
+ store.updateRecord(object, id, foo, Store.NEVER);
+ Foo foo2 = (Foo) store.readRecord(object, id);
+ assertEquals("test2", foo2.data);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ds = TestUtils.createTables();
+ store = new JDBCStore(ds, new HSQLDBConverter(), EasyMock.createNiceMock(StoreMonitor.class));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanup(ds);
+ }
+
+ @SuppressWarnings({"SerializableHasSerializationMethods"})
+ public static class Foo implements Serializable {
+ private static final long serialVersionUID = -4284779882741318884L;
+ private String data;
+
+ public Foo(String data) {
+ this.data = data;
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/RecordTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/RecordTestCase.java
new file mode 100644
index 0000000000..660e906cef
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/RecordTestCase.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.util.UUID;
+
+import junit.framework.TestCase;
+import static org.apache.tuscany.spi.services.store.Store.NEVER;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RecordTestCase extends TestCase {
+
+ public void testInsertCompare() {
+ Record record = new Record(null, UUID.randomUUID().toString(), "foo", NEVER, Record.INSERT);
+ Record record2 = new Record(null, UUID.randomUUID().toString(), "bar", NEVER, Record.INSERT);
+ assertEquals(0, record.compareTo(record2));
+ }
+
+ public void testUpdateCompare() {
+ Record record = new Record(null, UUID.randomUUID().toString(), "foo", NEVER, Record.UPDATE);
+ Record record2 = new Record(null, UUID.randomUUID().toString(), "bar", NEVER, Record.UPDATE);
+ assertEquals(0, record.compareTo(record2));
+ }
+
+ public void testInsertUpdateCompare() {
+ Record record = new Record(null, UUID.randomUUID().toString(), "foo", NEVER, Record.INSERT);
+ Record record2 = new Record(null, UUID.randomUUID().toString(), "bar", NEVER, Record.UPDATE);
+ assertEquals(-1, record.compareTo(record2));
+ }
+
+ public void testUpdateInsertCompare() {
+ Record record = new Record(null, UUID.randomUUID().toString(), "foo", NEVER, Record.UPDATE);
+ Record record2 = new Record(null, UUID.randomUUID().toString(), "bar", NEVER, Record.INSERT);
+ assertEquals(1, record.compareTo(record2));
+ }
+
+ public void testAssertion() {
+ Record record = new Record(null, UUID.randomUUID().toString(), "foo", NEVER, 4);
+ Record record2 = new Record(null, UUID.randomUUID().toString(), "bar", NEVER, 5);
+ try {
+ record.compareTo(record2);
+ fail();
+ } catch (AssertionError e) {
+ // expected
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/TestUtils.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/TestUtils.java
new file mode 100644
index 0000000000..8fb1c966c9
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/TestUtils.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import javax.sql.DataSource;
+
+import org.apache.commons.dbcp.BasicDataSource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class TestUtils {
+
+ public static final String CREATE_TABLE =
+ "CREATE TABLE CONVERSATION_STATE(OWNER VARCHAR, ID VARCHAR, EXPIRATION BIGINT, "
+ + "OBJECT LONGVARBINARY);";
+
+ public static final String DROP_TABLE = "DROP TABLE CONVERSATION_STATE IF EXISTS";
+ public static final String SELECT_SQL = "SELECT * FROM CONVERSATION_STATE";
+
+ private TestUtils() {
+ }
+
+ public static DataSource createTables() throws SQLException {
+ BasicDataSource ds = new BasicDataSource();
+ ds.setDriverClassName("org.hsqldb.jdbcDriver");
+ ds.setUrl("jdbc:hsqldb:mem:test");
+ Connection conn = null;
+ try {
+ conn = ds.getConnection();
+ conn.createStatement().execute(CREATE_TABLE);
+ conn.commit();
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ return ds;
+ }
+
+ public static void cleanup(DataSource ds) throws SQLException {
+ Connection conn = null;
+ try {
+ conn = ds.getConnection();
+ conn.createStatement().execute(DROP_TABLE);
+ conn.createStatement().execute("SHUTDOWN");
+ conn.commit();
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverterTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverterTestCase.java
new file mode 100644
index 0000000000..0d8f48e126
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/AbstractConverterTestCase.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.converter;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+
+import org.apache.tuscany.spi.services.store.StoreReadException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractConverterTestCase extends TestCase {
+
+ public void testSerializeDeserialize() throws Exception {
+ TestConverter converter = new TestConverter();
+ Foo foo = new Foo();
+ foo.data = "test";
+ byte[] bytes = converter.serialize(foo);
+ Foo foo2 = (Foo) converter.deserialize(bytes);
+ assertEquals("test", foo2.data);
+ }
+
+ private class TestConverter extends AbstractConverter {
+
+ public void insert(PreparedStatement stmt, String ownerId, String id, long expiration, Serializable object)
+ throws StoreWriteException {
+
+ }
+
+ public void update(PreparedStatement stmt, String ownerId, String id, Serializable object)
+ throws StoreWriteException {
+
+ }
+
+ public boolean findAndLock(PreparedStatement stmt,
+ String ownerId,
+ String id
+ ) throws StoreWriteException {
+ return false;
+ }
+
+ public Object read(Connection conn, String ownerId, String id) throws StoreReadException {
+ return null;
+ }
+
+ public void delete(PreparedStatement stmt, String ownerId, String id) throws StoreWriteException {
+
+ }
+
+ @Override
+ public byte[] serialize(Serializable serializable) throws IOException {
+ return super.serialize(serializable);
+ }
+
+ @Override
+ public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+ return super.deserialize(bytes);
+ }
+ }
+
+ @SuppressWarnings({"SerializableHasSerializationMethods"})
+ private static class Foo implements Serializable {
+ private static final long serialVersionUID = -3774909621298751358L;
+ private String data;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverterTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverterTestCase.java
new file mode 100644
index 0000000000..472c523217
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/converter/HSQLDBConverterTestCase.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.converter;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.UUID;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.spi.services.store.Store;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.service.persistence.store.jdbc.Converter;
+import static org.apache.tuscany.service.persistence.store.jdbc.TestUtils.cleanup;
+import static org.apache.tuscany.service.persistence.store.jdbc.TestUtils.createTables;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HSQLDBConverterTestCase extends TestCase {
+
+ private Converter converter;
+ private DataSource ds;
+
+ public void testWriteRead() throws Exception {
+ Connection conn = ds.getConnection();
+ conn.setAutoCommit(false);
+ PreparedStatement stmt = conn.prepareStatement(converter.getInsertSql());
+ String id = UUID.randomUUID().toString();
+ Foo foo = new Foo();
+ foo.data = "test";
+ converter.insert(stmt, "foo", id, Store.NEVER, foo);
+ stmt.addBatch();
+ stmt.execute();
+ stmt.close();
+ conn.commit();
+ conn.close();
+ conn = ds.getConnection();
+ conn.setAutoCommit(false);
+ Foo foo2 = (Foo) converter.read(conn, "foo", id);
+ assertEquals("test", foo2.data);
+ conn.commit();
+ conn.close();
+ }
+
+ public void testNotFound() throws Exception {
+ Connection conn = ds.getConnection();
+ conn.setAutoCommit(false);
+ String id = UUID.randomUUID().toString();
+ assertNull(converter.read(conn, null, id));
+ conn.commit();
+ conn.close();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ converter = new HSQLDBConverter();
+ ds = createTables();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ cleanup(ds);
+ }
+
+ @SuppressWarnings({"SerializableHasSerializationMethods"})
+ private static class Foo implements Serializable {
+ private static final long serialVersionUID = -6119188073169441225L;
+ private String data;
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/integration/BootstrapTestCase.java b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/integration/BootstrapTestCase.java
new file mode 100644
index 0000000000..4225cf65ba
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.jdbc/src/test/java/org/apache/tuscany/service/persistence/store/jdbc/integration/BootstrapTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.persistence.store.jdbc.integration;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BootstrapTestCase extends TestCase {
+
+ public void testBoot() throws Exception {
+ // TODO
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/.ruleset b/sandbox/old/contrib/persistence/store.journal/.ruleset
new file mode 100644
index 0000000000..a1547fea92
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/persistence/store.journal/LICENSE.txt b/sandbox/old/contrib/persistence/store.journal/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/persistence/store.journal/NOTICE.txt b/sandbox/old/contrib/persistence/store.journal/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/persistence/store.journal/pom.xml.off b/sandbox/old/contrib/persistence/store.journal/pom.xml.off
new file mode 100644
index 0000000000..679dcfe649
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/pom.xml.off
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.persistence</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>persistence-store-journal</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Journal Store</name>
+ <description>Defines a journal-based persistent store.</description>
+ <repositories>
+ <repository>
+ <id>objectweb</id>
+ <name>ObjectWeb repo</name>
+ <url>http://maven.objectweb.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>journalPerfTest</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>journalPerfTest</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.objectweb.howl</groupId>
+ <artifactId>howl</artifactId>
+ <version>1.0.1-1</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/CacheEventListener.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/CacheEventListener.java
new file mode 100644
index 0000000000..df6d3452e2
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/CacheEventListener.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+/**
+ * A listener interface for cache events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CacheEventListener {
+
+ /**
+ * Callback when an entry is evicted from the cache
+ */
+ void onEviction(RecordKey key, RecordEntry entry);
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Header.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Header.java
new file mode 100644
index 0000000000..f2cae6218a
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Header.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+/**
+ * A header entry for a record written to the log. A header contains the following information:
+ * <pre>
+ * <ul>
+ * <li><strong>Owner id</strong> - the unique id of the owner, typically the SCAObject canonical name
+ * <li><strong>Operation</strong> - if the record is an INSERT, UPDATE, or DELETE
+ * <li><strong>Most Significant bits</strong> - the most signficant bits of the <code>java.util.UUID</code>
+ * representing the id of the persisted instance
+ * <li><strong>Least Significant bits</strong> - the least signficant bits of the <code>java.util.UUID</code>
+ * representing the id of the persisted instance
+ * <li><strong>Expiration</strong> - the expiration time in milliseconds when the record is set to expire
+ * <li><strong>Number of blocks</strong> - the number of blocks the record is written across
+ * <li><strong>Fields</strong> - any other data associated with the header
+ * </ul>
+ * </pre>
+ *
+ * @version $Rev$ $Date$
+ */
+public class Header {
+ public static final short INSERT = 0;
+ public static final short UPDATE = 1;
+ public static final short DELETE = 2;
+
+ protected byte[][] fields;
+ private short operation;
+ private String ownerId;
+ private String id;
+ private long expiration;
+ private int numBlocks;
+
+ public Header() {
+ }
+
+ /**
+ * Returns the record operation type
+ *
+ * @return the record operation type
+ */
+ public short getOperation() {
+ return operation;
+ }
+
+ /**
+ * Sets the record operation type
+ */
+ public void setOperation(short operation) {
+ this.operation = operation;
+ }
+
+ /**
+ * Returns the number of blocks the record is written across
+ *
+ * @return the number of blocks the record is written across
+ */
+ public int getNumBlocks() {
+ return numBlocks;
+ }
+
+ /**
+ * Sets the number of blocks the record is written across
+ */
+ public void setNumBlocks(int numBlocks) {
+ this.numBlocks = numBlocks;
+ }
+
+ /**
+ * Returns the unique owner id
+ *
+ * @return the unique owner id
+ */
+ public String getOwnerId() {
+ return ownerId;
+ }
+
+ /**
+ * Sets the unique owner id
+ */
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+
+ /**
+ * Returns the record id
+ *
+ * @return the record id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the most significant bits of the record UUID
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the time in milliseconds the record is set to expire
+ *
+ * @return the time in milliseconds the record is set to expire
+ */
+ public long getExpiration() {
+ return expiration;
+ }
+
+ /**
+ * Sets the time the record is set to expire in milliseconds
+ */
+ public void setExpiration(long expiration) {
+ this.expiration = expiration;
+ }
+
+ /**
+ * Returns additional header data
+ *
+ * @return additional header data
+ */
+ public byte[][] getFields() {
+ return fields;
+ }
+
+ /**
+ * Sets additional header data
+ */
+ public void setFields(byte[][] fields) {
+ this.fields = fields;
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Journal.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Journal.java
new file mode 100644
index 0000000000..b8dfd072c5
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/Journal.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.IOException;
+
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.objectweb.howl.log.Configuration;
+import org.objectweb.howl.log.LogClosedException;
+import org.objectweb.howl.log.LogFileOverflowException;
+import org.objectweb.howl.log.LogRecordSizeException;
+import org.objectweb.howl.log.Logger;
+
+/**
+ * Extends the HOWL logger implementation adding convenience methods for processing records
+ *
+ * @version $Rev$ $Date$
+ */
+public class Journal extends Logger {
+ public static final short HEADER = 0;
+ public static final short RECORD = 1;
+
+ public Journal() throws IOException {
+ }
+
+ public Journal(Configuration config) throws IOException {
+ super(config);
+ }
+
+ /**
+ * Writes a header record to the log. The format of the header is defined by {@link
+ * SerializationHelper#createHeader(short, int, String, String, long)}
+ *
+ * @param bytes the record as a byte array
+ * @param force true if the disk write should be forced
+ * @return the log entry key
+ * @throws StoreWriteException
+ */
+ public long writeHeader(byte[] bytes, boolean force) throws StoreWriteException {
+ try {
+ return put(HEADER, new byte[][]{bytes}, force);
+ } catch (LogRecordSizeException e) {
+ throw new StoreWriteException(e);
+ } catch (LogFileOverflowException e) {
+ throw new StoreWriteException(e);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ } catch (LogClosedException e) {
+ throw new StoreWriteException(e);
+ } catch (InterruptedException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ /**
+ * Writes a record block to the log. The block may be the complete number of bytes or a chunked part of thereof if
+ * it does not fit within HOWL's block size limit.
+ *
+ * @param data the data to write
+ * @param id the unique record id consisting of the owner id and the UUID
+ * @param force true if the disk write should be force. For records that are written in multiple blocks, only the
+ * last write should be forced.
+ * @return the log entry key
+ * @throws StoreWriteException
+ */
+ public long writeBlock(byte[] data, byte[] id, boolean force) throws StoreWriteException {
+ try {
+ return put(RECORD, new byte[][]{id, data}, force);
+ } catch (LogRecordSizeException e) {
+ throw new StoreWriteException(e);
+ } catch (LogFileOverflowException e) {
+ throw new StoreWriteException(e);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ } catch (LogClosedException e) {
+ throw new StoreWriteException(e);
+ } catch (InterruptedException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalIinitializationException.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalIinitializationException.java
new file mode 100644
index 0000000000..910598fc61
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalIinitializationException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import org.apache.tuscany.spi.services.store.StoreException;
+
+/**
+ * Denotes an error starting the journal
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalIinitializationException extends StoreException {
+
+ public JournalIinitializationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalRecord.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalRecord.java
new file mode 100644
index 0000000000..ec2e491c1d
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalRecord.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+/**
+ * Represents a record read from the log
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalRecord {
+
+ private Header header;
+ private byte[] data;
+
+ public JournalRecord(byte[] data) {
+ this.data = data;
+ }
+
+ /**
+ * Returns the record header
+ *
+ * @return the record header
+ */
+ public Header getHeader() {
+ return header;
+ }
+
+ /**
+ * Sets the record header
+ */
+ public void setHeader(Header header) {
+ this.header = header;
+ }
+
+ /**
+ * Returns the serialized data portion of the record which may be assembled from multiple blocks
+ *
+ * @return the serialized data portion of the record which may be assembled from multiple blocks
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * Sets the serialized data portion of the record which may be written across multiple blocks
+ */
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalShutdownException.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalShutdownException.java
new file mode 100644
index 0000000000..945a77753a
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalShutdownException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import org.apache.tuscany.spi.services.store.StoreException;
+
+/**
+ * Denotes an error shutting down the journal
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalShutdownException extends StoreException {
+
+ public JournalShutdownException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStore.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStore.java
new file mode 100644
index 0000000000..422c074790
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStore.java
@@ -0,0 +1,595 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
+import org.osoa.sca.annotations.Constructor;
+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.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.StoreReadException;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.api.annotation.Monitor;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.partition;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serialize;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeHeader;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeRecordId;
+import org.objectweb.howl.log.Configuration;
+import org.objectweb.howl.log.InvalidFileSetException;
+import org.objectweb.howl.log.InvalidLogBufferException;
+import org.objectweb.howl.log.InvalidLogKeyException;
+import org.objectweb.howl.log.LogClosedException;
+import org.objectweb.howl.log.LogConfigurationException;
+import org.objectweb.howl.log.LogEventListener;
+import org.objectweb.howl.log.LogException;
+import org.objectweb.howl.log.LogFileOverflowException;
+import org.objectweb.howl.log.LogRecord;
+import org.objectweb.howl.log.LogRecordSizeException;
+
+/**
+ * A journal-based store service that uses HOWL for reliable persistence and recovery of object instances. Insert,
+ * update, and delete operations, as well as object instances, are written to a binary log. Delete operations are
+ * written as a single header block as defined by {@link SerializationHelper#serializeHeader(short,int,String,String,
+ *long)}. Insert and update operations are written using multiple blocks consisting of at least one header and 1..n
+ * additional blocks containing the object byte array. If the byte array size is greater than the log block size (the
+ * HOWL default is 4K), it must be partitioned into smaller units using {@link SerializationHelper#partition(byte[],
+ *int)} and written across multiple blocks. The header contains the number of ensuing blocks a record occupies. Since
+ * block writes to the log may be interleaved, blocks for a given record may not be consecutive. In order to identify
+ * the record a block belongs to, the first byte array of written data for the block contains the serialized owner id
+ * and UUID associated with the record.
+ * <p/>
+ * A cache of all active persisted instances is maintained in memory and is used for read operations. When an instance
+ * is persisted, a log record is written and an entry is added to the cache containing the instance. When an instance is
+ * deleted, a delete record is written to the log and its corresponding cache entry is removed. During recovery, the
+ * instance cache is reconstituted by reading the log and deserializing active records.
+ * <p/>
+ * The journal store is designed for reliable, performant persistence and therefore avoids the overhead associated with
+ * using a relational database. This does, however, impose two configuration requirements. The first is that a log file
+ * must be larger than the size of all <bold>active</bold> instances in the runtime. As a log file begins to fill, the
+ * store will copy active records (expired records will be ignored) to a new file and the old log will be recycled. A
+ * second requirement is that all active instances must fit within the memory limits of the runtime JVM since the store
+ * does not perform passivation and a table of all active instances is maintained for querying.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Store.class)
+@EagerInit
+public class JournalStore extends AbstractEventPublisher implements Store {
+ private static final int UNITIALIZED = -99;
+
+ // the cache of active records
+ private ConcurrentHashMap<RecordKey, RecordEntry> cache;
+ // private ReadWriteLock lock = new ReentrantReadWriteLock();
+ private final Object shutdownLock = new Object();
+ // TODO integrate with a core threading scheme
+ private ScheduledExecutorService scheduler;
+ private StoreMonitor monitor;
+ private Journal journal;
+ private long defaultExpirationOffset = 600000; // 10 minutes
+ private long reaperInterval = 1000;
+ private int blockSize = 4096; // 4k standard for HOWL
+
+ private Configuration config;
+ // HOWL properties - cf. <code>org.objectweb.howl.log.Configuration</code>
+ private boolean checksumEnabled;
+ private int bufferSize = UNITIALIZED;
+ private String bufferClassName;
+ private int maxBuffers = UNITIALIZED;
+ private int minBuffers = UNITIALIZED;
+ private int flushSleepTime = UNITIALIZED;
+ private boolean flushPartialBuffers;
+ private int threadsWaitingForceThreshold = UNITIALIZED;
+ private int maxBlocksPerFile = UNITIALIZED;
+ private int maxLogFiles = UNITIALIZED;
+ private String logFileDir = "../stores";
+ private String logFileExt = "store";
+ private String logFileName = "tuscany";
+ private String logFileMode;
+ // end HOWL properties
+
+ /**
+ * Creates a new store instance
+ *
+ * @param monitor the monitor for recording store events
+ */
+ @Constructor
+ public JournalStore(@Monitor StoreMonitor monitor) {
+ this.monitor = monitor;
+ config = new Configuration();
+ }
+
+ /**
+ * Protected constructor for unit testing
+ *
+ * @param monitor the monitor for recording store events
+ * @param journal the journal the store should write to, typically a mock
+ */
+ protected JournalStore(StoreMonitor monitor, Journal journal) {
+ this.monitor = monitor;
+ this.journal = journal;
+ config = new Configuration();
+ }
+
+ public int getBlockSize() {
+ return blockSize;
+ }
+
+ /**
+ * Returns the maximum default expiration offset for records in the store
+ *
+ * @return the maximum default expiration offset for records in the store
+ */
+ @Property
+ public long getExpirationOffset() {
+ return defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the maximum default expiration offset for records in the store
+ */
+ public void setDefaultExpirationOffset(long defaultExpirationOffset) {
+ this.defaultExpirationOffset = defaultExpirationOffset;
+ }
+
+ @Property
+ public void setBlockSize(int blockSize) {
+ this.blockSize = blockSize;
+ }
+
+ public boolean isChecksumEnabled() {
+ return checksumEnabled;
+ }
+
+ @Property
+ public void setChecksumEnabled(boolean val) {
+ config.setChecksumEnabled(val);
+ this.checksumEnabled = val;
+ }
+
+ public int getBufferSize() {
+ return bufferSize;
+ }
+
+ @Property
+ public void setBufferSize(int bufferSize) throws JournalStorePropertyException {
+ try {
+ config.setBufferSize(bufferSize);
+ this.bufferSize = bufferSize;
+ } catch (LogConfigurationException e) {
+ throw new JournalStorePropertyException(e);
+ }
+ }
+
+ public String getBufferClassName() {
+ return bufferClassName;
+ }
+
+ @Property
+ public void setBufferClassName(String bufferClassName) {
+ config.setBufferClassName(bufferClassName);
+ this.bufferClassName = bufferClassName;
+ }
+
+ public int getMaxBuffers() {
+ return maxBuffers;
+ }
+
+ @Property
+ public void setMaxBuffers(int maxBuffers) throws JournalStorePropertyException {
+ try {
+ config.setMaxBuffers(maxBuffers);
+ this.maxBuffers = maxBuffers;
+ } catch (LogConfigurationException e) {
+ throw new JournalStorePropertyException(e);
+ }
+ }
+
+ public int getMinBuffers() {
+ return minBuffers;
+ }
+
+ @Property
+ public void setMinBuffers(int minBuffers) throws JournalStorePropertyException {
+ try {
+ config.setMinBuffers(minBuffers);
+ this.minBuffers = minBuffers;
+ } catch (LogConfigurationException e) {
+ throw new JournalStorePropertyException(e);
+ }
+ }
+
+ public int getFlushSleepTime() {
+ return flushSleepTime;
+ }
+
+ @Property
+ public void setFlushSleepTime(int time) {
+ config.setFlushSleepTime(time);
+ this.flushSleepTime = time;
+ }
+
+ public boolean isFlushPartialBuffers() {
+ return flushPartialBuffers;
+ }
+
+ @Property
+ public void setFlushPartialBuffers(boolean val) {
+ config.setFlushPartialBuffers(val);
+ this.flushPartialBuffers = val;
+ }
+
+ public int getThreadsWaitingForceThreshold() {
+ return threadsWaitingForceThreshold;
+ }
+
+ @Property
+ public void setThreadsWaitingForceThreshold(int threshold) {
+ config.setThreadsWaitingForceThreshold(threshold);
+ this.threadsWaitingForceThreshold = threshold;
+ }
+
+ public int getMaxBlocksPerFile() {
+ return maxBlocksPerFile;
+ }
+
+ @Property
+ public void setMaxBlocksPerFile(int maxBlocksPerFile) {
+ config.setMaxBlocksPerFile(maxBlocksPerFile);
+ this.maxBlocksPerFile = maxBlocksPerFile;
+ }
+
+ public int getMaxLogFiles() {
+ return maxLogFiles;
+ }
+
+ @Property
+ public void setMaxLogFiles(int maxLogFiles) {
+ config.setMaxLogFiles(maxLogFiles);
+ this.maxLogFiles = maxLogFiles;
+ }
+
+ public String getLogFileDir() {
+ return logFileDir;
+ }
+
+ @Property
+ public void setLogFileDir(String dir) {
+ config.setLogFileDir(dir);
+ this.logFileDir = dir;
+ }
+
+ public String getLogFileExt() {
+ return logFileExt;
+ }
+
+ @Property
+ public void setLogFileExt(String logFileExt) {
+ config.setLogFileExt(logFileExt);
+ this.logFileExt = logFileExt;
+ }
+
+ public String getLogFileName() {
+ return logFileName;
+ }
+
+ @Property
+ public void setLogFileName(String logFileName) {
+ config.setLogFileName(logFileName);
+ this.logFileName = logFileName;
+ }
+
+ public String getLogFileMode() {
+ return logFileMode;
+ }
+
+ public void setLogFileMode(String logFileMode) throws JournalStorePropertyException {
+ try {
+ config.setLogFileMode(logFileMode);
+ this.logFileMode = logFileMode;
+ } catch (LogConfigurationException e) {
+ throw new JournalStorePropertyException(e);
+ }
+ }
+
+ /**
+ * Initializes the store by opening the journal and starting the checkpoint daemon
+ *
+ * @throws JournalIinitializationException
+ *
+ */
+ @Init
+ public void init() throws JournalIinitializationException {
+ try {
+ cache = new ConcurrentHashMap<RecordKey, RecordEntry>();
+ if (journal == null) {
+ config.setLogFileName(logFileName);
+ config.setLogFileExt(logFileExt);
+ config.setLogFileDir(logFileDir);
+ journal = new Journal(config);
+ }
+ journal.setLogEventListener(new JournalLogEventListener());
+ journal.open();
+ scheduler = Executors.newSingleThreadScheduledExecutor();
+ scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, MILLISECONDS);
+ monitor.start("Started journal store");
+ } catch (IOException e) {
+ throw new JournalIinitializationException(e);
+ } catch (LogConfigurationException e) {
+ throw new JournalIinitializationException(e);
+ } catch (InvalidLogBufferException e) {
+ throw new JournalIinitializationException(e);
+ } catch (InterruptedException e) {
+ throw new JournalIinitializationException(e);
+ } catch (InvalidFileSetException e) {
+ throw new JournalIinitializationException(e);
+ }
+ }
+
+ /**
+ * Performs an orderly close of the journal and checkpoint daemon
+ *
+ * @throws JournalShutdownException
+ */
+ @Destroy
+ public void destroy() throws JournalShutdownException {
+ try {
+ // avoid potential deadlock by acquiring write lock since the reaper thread can block when calling a
+ // synchronized journal method (e.g. journal.put) since journal.close() below holds a synchronization lock.
+ // This deadlock will prevent the scheduler.shutdown from completing, hanging this store shutdown
+ synchronized (shutdownLock) {
+ scheduler.shutdown();
+ journal.close();
+ monitor.stop("Stopped journal store");
+ }
+ } catch (IOException e) {
+ throw new JournalShutdownException(e);
+ } catch (InterruptedException e) {
+ throw new JournalShutdownException(e);
+ }
+ }
+
+ public void insertRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ write(owner, id, object, expiration, Header.INSERT);
+ }
+
+ public void updateRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ write(owner, id, object, expiration, Header.UPDATE);
+ }
+
+ public Object readRecord(SCAObject owner, String id) throws StoreReadException {
+ RecordEntry record;
+ RecordKey key = new RecordKey(id, owner);
+ record = cache.get(key);
+ if (record == null) {
+ return null;
+ }
+ if (record.getExpiration() != Store.NEVER && record.getExpiration() < System.currentTimeMillis()) {
+ cache.remove(key);
+ }
+ return record.getObject();
+ }
+
+ public void removeRecord(SCAObject owner, String id) throws StoreWriteException {
+ try {
+ journal.writeHeader(serializeHeader(Header.DELETE, 0, owner.getUri().toString(), id, NEVER), true);
+ RecordKey key = new RecordKey(id, owner);
+ // remove from the cache
+ cache.remove(key);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+
+ }
+
+ public void removeRecords() throws StoreWriteException {
+
+ }
+
+ public void recover(RecoveryListener listener) throws StoreReadException {
+ }
+
+ /**
+ * Writes a record to the log. If a record needs to be written in multiple blocks, only the last block write is
+ * forced.
+ *
+ * @param owner
+ * @param id
+ * @param object
+ * @param expiration
+ * @param operation
+ * @throws StoreWriteException
+ */
+ private void write(SCAObject owner, String id, Object object, long expiration, short operation)
+ throws StoreWriteException {
+ if (!(object instanceof Serializable)) {
+ String name = object.getClass().getName();
+ throw new StoreWriteException("Type must implement serializable", name, id);
+ }
+ Serializable serializable = (Serializable) object;
+ String name = owner.getUri().toString();
+ List<byte[]> bytes;
+ try {
+ bytes = partition(serialize(serializable), blockSize);
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+ try {
+ byte[] header = serializeHeader(operation, bytes.size(), name, id, expiration);
+ long headerKey = journal.writeHeader(header, false);
+ // write chunked records in non-forced mode except last one
+ byte[] recordId = serializeRecordId(name, id);
+ long[] keys = new long[bytes.size() + 1];
+ keys[0] = headerKey;
+ for (int i = 0; i < bytes.size() - 1; i++) {
+ byte[] chunk = bytes.get(i);
+ keys[i + 1] = journal.writeBlock(chunk, recordId, false);
+ }
+ // add last record using a forced write
+ journal.writeBlock(bytes.get(bytes.size() - 1), recordId, true);
+ RecordKey key = new RecordKey(id, owner);
+ // add to the entry in the cache
+ cache.put(key, new RecordEntry(serializable, operation, keys, expiration));
+ } catch (IOException e) {
+ throw new StoreWriteException(e);
+ }
+ }
+
+ /**
+ * Handles log overflow events
+ */
+ private class JournalLogEventListener implements LogEventListener {
+
+ public void logOverflowNotification(long overflowFence) {
+ assert overflowFence != 0;
+ long newMark = Long.MAX_VALUE;
+ long now = System.currentTimeMillis();
+ try {
+ for (Map.Entry<RecordKey, RecordEntry> entry : cache.entrySet()) {
+ RecordEntry record = entry.getValue();
+ long[] journalKey = record.getJournalKeys();
+ if (journalKey[0] > overflowFence) {
+ // do not copy to new log but check if this is the new mark
+ if (journalKey[0] < newMark) {
+ newMark = journalKey[0];
+ }
+ continue;
+ }
+ if (entry.getValue().getExpiration() > now) {
+ // copy the blocks associayed with the record to the new journal only if it is not expired
+ for (long key : journalKey) {
+ LogRecord lrecord = journal.get(null, key);
+ journal.put(lrecord.getFields(), false);
+
+ }
+ }
+ }
+ if (newMark == Long.MAX_VALUE) {
+ newMark = overflowFence;
+ }
+ // force write
+ journal.mark(newMark, true);
+ } catch (LogRecordSizeException e) {
+ monitor.error(e);
+ } catch (LogFileOverflowException e) {
+ monitor.error(e);
+ } catch (LogConfigurationException e) {
+ monitor.error(e);
+ } catch (IOException e) {
+ monitor.error(e);
+ } catch (InvalidLogBufferException e) {
+ monitor.error(e);
+ } catch (LogClosedException e) {
+ monitor.error(e);
+ } catch (LogException e) {
+ monitor.error(e);
+ } catch (InterruptedException e) {
+ monitor.error(e);
+ }
+ }
+
+ public boolean isLoggable(int level) {
+ return false;
+ }
+
+ public void log(int level, String message) {
+
+ }
+
+ public void log(int level, String message, Throwable thrown) {
+
+ }
+ }
+
+ /**
+ * Periodically scans the instance cache, clearing out expired entries
+ */
+ private class Reaper implements Runnable {
+
+ public void run() {
+ try {
+ synchronized (shutdownLock) {
+ boolean force = false;
+ long now = System.currentTimeMillis();
+ long oldest = Long.MAX_VALUE;
+ for (Map.Entry<RecordKey, RecordEntry> entry : cache.entrySet()) {
+ RecordKey key = entry.getKey();
+ RecordEntry record = entry.getValue();
+ if (record.getExpiration() <= now) {
+ try {
+ String ownerName = key.getOwner().getUri().toString();
+ String id = key.getId();
+ byte[] header =
+ SerializationHelper.serializeHeader(Header.DELETE, 0, ownerName, id, Store.NEVER);
+ journal.writeHeader(header, false);
+ // notify listeners
+ SCAObject owner = key.getOwner();
+ Object instance = record.getObject();
+ // notify listeners of the expiration
+ StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance);
+ publish(event);
+ } catch (IOException e) {
+ monitor.error(e);
+ } catch (StoreWriteException e) {
+ monitor.error(e);
+ }
+ force = true;
+ cache.remove(entry.getKey()); // semantics of ConcurrentHashMap allow this
+ } else {
+ if (record.getJournalKeys()[0] < oldest) {
+ oldest = record.getJournalKeys()[0];
+ }
+ }
+ }
+ if (force) {
+ // perform a forced write and update the journal mark
+ journal.mark(oldest, true);
+ }
+ }
+ } catch (IOException e) {
+ monitor.error(e);
+ } catch (LogClosedException e) {
+ monitor.error(e);
+ } catch (InvalidLogKeyException e) {
+ monitor.error(e);
+ } catch (InterruptedException e) {
+ monitor.error(e);
+ }
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStorePropertyException.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStorePropertyException.java
new file mode 100644
index 0000000000..275bad21f7
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/JournalStorePropertyException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import org.apache.tuscany.spi.services.store.StoreException;
+
+/**
+ * Denotes an error setting a property on the journal store
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalStorePropertyException extends StoreException {
+
+ public JournalStorePropertyException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordEntry.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordEntry.java
new file mode 100644
index 0000000000..28fa9c43ac
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordEntry.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.Serializable;
+
+/**
+ * A journal store cache entry for a record
+ *
+ * @version $Rev$ $Date$
+ */
+public class RecordEntry {
+ private Serializable object;
+ private short operation;
+ private long expiration;
+ private long[] journalKeys;
+
+
+ /**
+ * Creates a new cached record
+ *
+ * @param object the object to serialize
+ * @param operation an <code>INSERT</code> or <code>UPDATE</code> operation
+ * @param journalKey the journal key for the block where the record is written
+ */
+ public RecordEntry(Serializable object, short operation, long[] journalKey, long expiration) {
+ assert object != null;
+ this.object = object;
+ this.operation = operation;
+ this.journalKeys = journalKey;
+ this.expiration = expiration;
+ }
+
+ /**
+ * Returns the object
+ *
+ * @return the object
+ */
+ public Serializable getObject() {
+ return object;
+ }
+
+ /**
+ * Returns the type of operation
+ *
+ * @return the type of operation
+ */
+ public short getOperation() {
+ return operation;
+ }
+
+ public long getExpiration() {
+ return expiration;
+ }
+
+ public long[] getJournalKeys() {
+ return journalKeys;
+ }
+
+ public void setJournalKeys(long[] journalKeys) {
+ this.journalKeys = journalKeys;
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordKey.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordKey.java
new file mode 100644
index 0000000000..7293fddb55
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/RecordKey.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import org.apache.tuscany.spi.component.SCAObject;
+
+/**
+ * Used by the store cache to retrieve record entries
+ *
+ * @version $Rev$ $Date$
+ */
+public class RecordKey {
+
+ private String id;
+ private SCAObject owner;
+
+ public RecordKey(String id, SCAObject owner) {
+ this.id = id;
+ this.owner = owner;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public SCAObject getOwner() {
+ return owner;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final RecordKey recordKey = (RecordKey) o;
+ if (id != null ? !id.equals(recordKey.id) : recordKey.id != null) {
+ return false;
+ }
+ return !(owner != null ? !owner.getUri().equals(recordKey.owner.getUri()) :
+ recordKey.owner != null);
+ }
+
+ public int hashCode() {
+ int result;
+ result = (id != null ? id.hashCode() : 0);
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/SerializationHelper.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/SerializationHelper.java
new file mode 100644
index 0000000000..0a7197b014
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/SerializationHelper.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * Utility methods for processing journal records
+ *
+ * @version $Rev$ $Date$
+ */
+public final class SerializationHelper {
+
+ private SerializationHelper() {
+ }
+
+ /**
+ * Serializes and object
+ *
+ * @param serializable the object to serialize
+ * @throws IOException
+ */
+ public static byte[] serialize(Serializable serializable) throws IOException {
+ ByteArrayOutputStream bas = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bas);
+ out.writeObject(serializable);
+ return bas.toByteArray();
+ }
+
+ /**
+ * Deserializes an object using the TCCL
+ *
+ * @param bytes the serialized object byte array
+ * @param workContext the current work context
+ */
+ public static Object deserialize(byte[] bytes, WorkContext workContext) throws IOException, ClassNotFoundException {
+ Object o = new TCCLObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
+ if (o instanceof SCAExternalizable) {
+ SCAExternalizable externalizable = (SCAExternalizable) o;
+ externalizable.setWorkContext(workContext);
+ externalizable.reactivate();
+ }
+ return o;
+ }
+
+ /**
+ * Breaks a byte array into a series of blocks of the given size
+ *
+ * @param bytes the byte array to partition
+ * @param size the partition size
+ */
+ public static List<byte[]> partition(byte[] bytes, int size) {
+ assert size > 0;
+ List<byte[]> list = new ArrayList<byte[]>();
+ int pos = 0;
+ while (pos < bytes.length) {
+ if (pos + size > bytes.length) {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ for (int i = pos; i < bytes.length; i++) {
+ stream.write(bytes[i]);
+ }
+ byte[] partition = stream.toByteArray();
+ list.add(partition);
+ pos = pos + partition.length;
+ } else {
+ byte[] partition = new byte[size];
+ for (int i = 0; i < size; i++) {
+ partition[i] = bytes[pos + i];
+ }
+ list.add(partition);
+ pos = pos + size;
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Creates a serialized header entry that may be written to a log
+ *
+ * @param operation the operation type, i.e. {@link Header#INSERT}, {@link Header#UPDATE}, or {@link
+ * JournalStore#DELETE}
+ * @param numRecords the number of blocks that the record will be written two excluding the header block
+ * @param ownerId the id of the owner of the record
+ * @param id the id of the record unique to the owner
+ * @param expiration the record expirtation time in milliseconds
+ * @return a byte array containing the serialized header
+ * @throws IOException
+ */
+ public static byte[] serializeHeader(short operation, int numRecords, String ownerId, String id, long expiration)
+ throws IOException {
+ ByteArrayOutputStream stream = null;
+ ObjectOutputStream ostream = null;
+ try {
+ stream = new ByteArrayOutputStream();
+ ostream = new ObjectOutputStream(stream);
+ ostream.writeShort(operation);
+ ostream.writeInt(numRecords);
+ ostream.writeObject(ownerId);
+ ostream.writeObject(id);
+ ostream.writeLong(expiration);
+ ostream.flush();
+ return stream.toByteArray();
+ } finally {
+ if (ostream != null) {
+ try {
+ ostream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Serializes a unique record id consisting of the owner id and the record's UUID
+ *
+ * @param ownerId the id of the owner, typically an SCAObject canonical name
+ * @param id the id associated with the record
+ * @return the serialized record byte array
+ * @throws IOException
+ */
+ public static byte[] serializeRecordId(String ownerId, String id)
+ throws IOException {
+ ByteArrayOutputStream stream = null;
+ ObjectOutputStream ostream = null;
+ try {
+ stream = new ByteArrayOutputStream();
+ ostream = new ObjectOutputStream(stream);
+ ostream.writeObject(ownerId);
+ ostream.writeObject(id);
+ ostream.flush();
+ return stream.toByteArray();
+ } finally {
+ if (ostream != null) {
+ try {
+ ostream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Deserializes the given header. The first element from {@link Header#getFields()} is assumed to contain the header
+ * byte array to deserialize from
+ *
+ * @param header the header to deserialize
+ * @return the deserialized header
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public static Header deserializeHeader(Header header) throws IOException, ClassNotFoundException {
+ ByteArrayInputStream bas = null;
+ ObjectInputStream stream = null;
+ try {
+ bas = new ByteArrayInputStream(header.getFields()[0]);
+ stream = new TCCLObjectInputStream(bas);
+ header.setOperation(stream.readShort());
+ header.setNumBlocks(stream.readInt());
+ header.setOwnerId((String) stream.readObject());
+ header.setId((String) stream.readObject());
+ header.setExpiration(stream.readLong());
+ return header;
+ } finally {
+ if (bas != null) {
+ try {
+ bas.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/TCCLObjectInputStream.java b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/TCCLObjectInputStream.java
new file mode 100644
index 0000000000..b341f9f9b9
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/main/java/org/apache/tuscany/persistence/store/journal/TCCLObjectInputStream.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * Deserializes an object based on the thread context classloader
+ *
+ * @version $Rev$ $Date$
+ */
+public class TCCLObjectInputStream extends ObjectInputStream {
+ private final ClassLoader classLoader;
+
+ public TCCLObjectInputStream(InputStream in) throws IOException, SecurityException {
+ super(in);
+ this.classLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ protected Class resolveClass(ObjectStreamClass streamClass) throws IOException, ClassNotFoundException {
+ return classLoader.loadClass(streamClass.getName());
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreExpireTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreExpireTestCase.java
new file mode 100644
index 0000000000..4e23b3ca72
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreExpireTestCase.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.services.store.StoreExpirationEvent;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.easymock.IAnswer;
+import org.easymock.classextension.EasyMock;
+import org.objectweb.howl.log.LogEventListener;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JournalStoreExpireTestCase extends TestCase {
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private JournalStore store;
+ private SCAObject owner;
+
+ public void testNotifyOnExpire() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ Journal journal = EasyMock.createNiceMock(Journal.class);
+ journal.setLogEventListener(EasyMock.isA(LogEventListener.class));
+ EasyMock.replay(journal);
+
+ RuntimeEventListener listener = org.easymock.EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(org.easymock.EasyMock.isA(StoreExpirationEvent.class));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ return null;
+ }
+ });
+ org.easymock.EasyMock.replay(listener);
+
+ store = new JournalStore(monitor, journal) {
+ };
+ store.addListener(listener);
+ store.init();
+ final String id = UUID.randomUUID().toString();
+ store.insertRecord(owner, id, "test", 1);
+ if (!latch.await(10000, TimeUnit.MILLISECONDS)) {
+ // failed to notify listener
+ fail();
+ }
+ store.destroy();
+ EasyMock.verify(listener);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ owner = EasyMock.createMock(SCAObject.class);
+ URI uri = URI.create("foo");
+ EasyMock.expect(owner.getUri()).andReturn(uri).atLeastOnce();
+ EasyMock.replay(owner);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanupLog();
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreInsertTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreInsertTestCase.java
new file mode 100644
index 0000000000..a2cab56134
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreInsertTestCase.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.util.UUID;
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.services.store.Store;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.easymock.IAnswer;
+import org.easymock.classextension.EasyMock;
+import org.objectweb.howl.log.LogEventListener;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JournalStoreInsertTestCase extends TestCase {
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private JournalStore store;
+ private SCAObject owner;
+
+ public void testOrderedShutdown() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ Journal journal = EasyMock.createMock(Journal.class);
+ journal.setLogEventListener(EasyMock.isA(LogEventListener.class));
+ journal.open();
+ journal.close();
+ EasyMock.replay(journal);
+ store = new JournalStore(monitor, journal) {
+ };
+ store.init();
+ store.destroy();
+ EasyMock.verify(journal);
+ }
+
+ public void testInsertRecord() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ Journal journal = EasyMock.createMock(Journal.class);
+ journal.setLogEventListener(EasyMock.isA(LogEventListener.class));
+ journal.open();
+ final String id = UUID.randomUUID().toString();
+ EasyMock.expect(journal.writeHeader(EasyMock.isA(byte[].class), EasyMock.eq(false)))
+ .andStubAnswer(new IAnswer<Long>() {
+ public Long answer() throws Throwable {
+ Header header = new Header();
+ header.setFields(new byte[][]{(byte[]) EasyMock.getCurrentArguments()[0]});
+ // deserialize the message to test the format is correct
+ SerializationHelper.deserializeHeader(header);
+ assertTrue("Operation not INSERT", Header.INSERT == header.getOperation());
+ assertTrue("Expiration incorrect", Store.NEVER == header.getExpiration());
+ assertTrue("Least significant id incorrect",
+ id.equals(header.getId()));
+ assertTrue("Most significant id incorrect",
+ id.equals(header.getId()));
+ assertTrue("Records incorrect", 1 == header.getNumBlocks());
+ assertTrue("Owner id incorrect", "foo".equals(header.getOwnerId()));
+ return 1L;
+ }
+ });
+ EasyMock.expect(journal.writeBlock(EasyMock.isA(byte[].class), EasyMock.isA(byte[].class), EasyMock.eq(true)))
+ .andStubAnswer(new IAnswer<Long>() {
+ public Long answer() throws Throwable {
+ byte[] payload = (byte[]) EasyMock.getCurrentArguments()[0];
+ assertTrue("Block data incorrect", "test".equals(SerializationHelper.deserialize(payload, null)));
+ return 1L;
+ }
+ });
+ journal.close();
+ EasyMock.replay(journal);
+ store = new JournalStore(monitor, journal) {
+ };
+ store.init();
+ store.insertRecord(owner, id, "test", Store.NEVER);
+ store.destroy();
+ EasyMock.verify(journal);
+ }
+
+ /**
+ * Verifies that a written record will be cached. This is verified by the fact that long-term storage is never
+ * accessed.
+ */
+ public void testInsertRecordCache() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ Journal journal = EasyMock.createMock(Journal.class);
+ journal.setLogEventListener(EasyMock.isA(LogEventListener.class));
+ journal.open();
+ final String id = UUID.randomUUID().toString();
+ EasyMock.expect(journal.writeHeader(EasyMock.isA(byte[].class), EasyMock.eq(false))).andReturn(1L);
+ EasyMock.expect(journal.writeBlock(EasyMock.isA(byte[].class), EasyMock.isA(byte[].class), EasyMock.eq(true)))
+ .andReturn(1L);
+ journal.close();
+ EasyMock.replay(journal);
+ store = new JournalStore(monitor, journal) {
+ };
+ store.init();
+ store.insertRecord(owner, id, "test", Store.NEVER);
+ assertEquals("test", store.readRecord(owner, id));
+ store.destroy();
+ EasyMock.verify(journal);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ owner = EasyMock.createMock(SCAObject.class);
+ URI uri = URI.create("foo");
+ EasyMock.expect(owner.getUri()).andReturn(uri).atLeastOnce();
+ EasyMock.replay(owner);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanupLog();
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreOverflowTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreOverflowTestCase.java
new file mode 100644
index 0000000000..61a77869c1
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalStoreOverflowTestCase.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.util.UUID;
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JournalStoreOverflowTestCase extends TestCase {
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private JournalStore store;
+ private SCAObject owner;
+
+ /**
+ * Validates records are moved forward during a log overflow
+ *
+ * @throws Exception
+ */
+ public void testOverflow() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ store = new JournalStore(monitor);
+ store.setMaxBlocksPerFile(3);
+ store.init();
+ long expire = System.currentTimeMillis() + 200;
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire); //
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire);
+ Thread.sleep(250);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire + 20000);
+ store.insertRecord(owner, UUID.randomUUID().toString(), "test", expire + 20000);
+ store.destroy();
+ }
+
+
+ public void testOverflowAtInsertHeader() throws Exception {
+
+ }
+
+ public void testOverflowAtUpdateHeader() throws Exception {
+
+ }
+
+ public void testOverflowAtDeleteHeader() throws Exception {
+
+ }
+
+ public void testOverflowAtBlock() throws Exception {
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ owner = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner.getUri()).andReturn(URI.create("foo")).atLeastOnce();
+ EasyMock.replay(owner);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanupLog();
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalTestCase.java
new file mode 100644
index 0000000000..2df83a0e74
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/JournalTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.ByteArrayOutputStream;
+import java.util.UUID;
+
+import static org.apache.tuscany.spi.services.store.Store.NEVER;
+
+import junit.framework.TestCase;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeHeader;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeRecordId;
+import org.objectweb.howl.log.Configuration;
+import org.objectweb.howl.log.LogRecord;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JournalTestCase extends TestCase {
+ private Journal journal;
+
+ public void testWriteHeader() throws Exception {
+ String id = UUID.randomUUID().toString();
+ long key = journal.writeHeader(serializeHeader(Header.INSERT, 10, "foo/bar", id, NEVER), false);
+ LogRecord record = journal.get(null, key);
+ Header header = new Header();
+ header.setFields(record.getFields());
+ SerializationHelper.deserializeHeader(header);
+ assertTrue(record.type == Journal.HEADER);
+ assertEquals(Header.INSERT, header.getOperation());
+ assertEquals(10, header.getNumBlocks());
+ assertEquals("foo/bar", header.getOwnerId());
+ assertEquals(id, header.getId());
+ assertEquals(NEVER, header.getExpiration());
+ }
+
+ public void testWriteRecord() throws Exception {
+ byte[] recordId = serializeRecordId("foo", UUID.randomUUID().toString());
+ long key = journal.writeBlock("this is a test".getBytes(), recordId, true);
+ LogRecord record = journal.get(null, key);
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ assertEquals(record.type, Journal.RECORD);
+ stream.write(record.getFields()[1]);
+ JournalRecord jrecord = new JournalRecord(stream.toByteArray());
+ assertEquals("this is a test", new String(jrecord.getData()));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ Configuration config = new Configuration();
+ config.setLogFileDir("../stores");
+ journal = new Journal(config);
+ journal.open();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ journal.close();
+ TestUtils.cleanupLog();
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/MockSCAExternalizable.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/MockSCAExternalizable.java
new file mode 100644
index 0000000000..62e8a50635
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/MockSCAExternalizable.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.apache.tuscany.spi.component.ReactivationException;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockSCAExternalizable implements Externalizable, SCAExternalizable {
+ private WorkContext context;
+ private boolean reactivated;
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+
+ }
+
+ public boolean isReactivated() {
+ return reactivated;
+ }
+
+ public void setWorkContext(WorkContext context) {
+ this.context = context;
+ }
+
+ public void reactivate() throws ReactivationException {
+ assert context != null : "WorkContext not properly set";
+ reactivated = true;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/RecordKeyTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/RecordKeyTestCase.java
new file mode 100644
index 0000000000..ddd69a1f54
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/RecordKeyTestCase.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.SCAObject;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RecordKeyTestCase extends TestCase {
+
+ public void testEquals() throws Exception {
+ String id = "bar";
+ URI uri = URI.create("foo");
+ SCAObject owner1 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner1.getUri()).andReturn(uri);
+ EasyMock.replay(owner1);
+ SCAObject owner2 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner2.getUri()).andReturn(uri);
+ EasyMock.replay(owner2);
+
+ RecordKey key1 = new RecordKey(id, owner1);
+ RecordKey key2 = new RecordKey(id, owner2);
+ assertEquals(key1, key2);
+ }
+
+ public void testNotEqualsId() throws Exception {
+ String id = "bar";
+ SCAObject owner1 = EasyMock.createMock(SCAObject.class);
+ URI uri = URI.create("foo");
+ EasyMock.expect(owner1.getUri()).andReturn(uri);
+ EasyMock.replay(owner1);
+ SCAObject owner2 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner2.getUri()).andReturn(uri);
+ EasyMock.replay(owner2);
+ RecordKey key1 = new RecordKey(id, owner1);
+ RecordKey key2 = new RecordKey("baz", owner2);
+ assertFalse(key1.equals(key2));
+ }
+
+ public void testNotEqualsOwner() throws Exception {
+ String id = "bar";
+ URI fooUri = URI.create("foo");
+ SCAObject owner1 = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(owner1.getUri()).andReturn(fooUri);
+ EasyMock.replay(owner1);
+ SCAObject owner2 = EasyMock.createMock(SCAObject.class);
+ URI barUri = URI.create("bar");
+ EasyMock.expect(owner2.getUri()).andReturn(barUri);
+ EasyMock.replay(owner2);
+ RecordKey key1 = new RecordKey(id, owner1);
+ RecordKey key2 = new RecordKey(id, owner2);
+ assertFalse(key1.equals(key2));
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/SerializationHelperTestCase.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/SerializationHelperTestCase.java
new file mode 100644
index 0000000000..160e4c7a23
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/SerializationHelperTestCase.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import static org.apache.tuscany.spi.services.store.Store.NEVER;
+
+import junit.framework.TestCase;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.deserialize;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SerializationHelperTestCase extends TestCase {
+
+ public void testTwoEvenChunks() throws Exception {
+ byte[] bytes = "this is a test".getBytes();
+ List<byte[]> chunks = SerializationHelper.partition(bytes, 7);
+ assertEquals(2, chunks.size());
+ assertEquals("this is", new String(chunks.get(0)));
+ assertEquals(" a test", new String(chunks.get(1)));
+ }
+
+ public void testUnevenChunks() throws Exception {
+ byte[] bytes = "this is a test123".getBytes();
+ List<byte[]> chunks = SerializationHelper.partition(bytes, 7);
+ assertEquals(3, chunks.size());
+ assertEquals("this is", new String(chunks.get(0)));
+ assertEquals(" a test", new String(chunks.get(1)));
+ assertEquals("123", new String(chunks.get(2)));
+ }
+
+ public void testChunkSizeGreater() throws Exception {
+ byte[] bytes = "this is a test".getBytes();
+ List<byte[]> chunks = SerializationHelper.partition(bytes, 512);
+ assertEquals(1, chunks.size());
+ byte[] chunk = chunks.get(0);
+ assertEquals(14, chunk.length);
+ assertEquals("this is a test", new String(chunk));
+ }
+
+ public void testSerializeDeserializeNonSCAExternalizable() throws Exception {
+ byte[] bytes = SerializationHelper.serialize("foo");
+ assertEquals("foo", deserialize(bytes, null));
+ }
+
+ public void testSerializeDeserializeSCAExternalizable() throws Exception {
+ byte[] bytes = SerializationHelper.serialize(new MockSCAExternalizable());
+ WorkContext context = EasyMock.createNiceMock(WorkContext.class);
+ MockSCAExternalizable externalized = (MockSCAExternalizable) deserialize(bytes, context);
+ assertTrue(externalized.isReactivated());
+ }
+
+ public void testDeserializeHeader() throws Exception {
+ String id = UUID.randomUUID().toString();
+ byte[] bytes = SerializationHelper.serializeHeader(Header.INSERT, 2, "foo", id, NEVER);
+ Header header = SerializationHelper.deserializeHeader(new MockHeader(bytes));
+ assertEquals(Header.INSERT, header.getOperation());
+ assertEquals(2, header.getNumBlocks());
+ assertEquals("foo", header.getOwnerId());
+ assertEquals(id, header.getId());
+ assertEquals(NEVER, header.getExpiration());
+ }
+
+ private class MockHeader extends Header {
+ public MockHeader(byte[] bytes) {
+ super();
+ fields = new byte[][]{bytes};
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/TestUtils.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/TestUtils.java
new file mode 100644
index 0000000000..5fb2ebeb82
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/TestUtils.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal;
+
+import java.io.File;
+
+/**
+ * JournalThroughputTest case utilities
+ *
+ * @version $Rev$ $Date$
+ */
+public final class TestUtils {
+
+ private TestUtils() {
+
+ }
+
+ /**
+ * Removes log files from disk
+ */
+ public static void cleanupLog() {
+ File dir = new File("../stores");
+ if (!dir.exists()) {
+ return;
+ }
+ for (File file : dir.listFiles()) {
+ file.delete();
+ }
+ dir.delete();
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/Foo.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/Foo.java
new file mode 100644
index 0000000000..d9c7aee660
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/Foo.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal.performance;
+
+import java.io.Serializable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"SerializableHasSerializationMethods"})
+public class Foo implements Serializable {
+ private static final long serialVersionUID = -1003664515513709814L;
+ protected String baz;
+ protected int bar;
+
+ public Foo(String baz, int bar) {
+ this.baz = baz;
+ this.bar = bar;
+ }
+
+ public String getBaz() {
+ return baz;
+ }
+
+ public void setBaz(String baz) {
+ this.baz = baz;
+ }
+
+ public int getBar() {
+ return bar;
+ }
+
+ public void setBar(int bar) {
+ this.bar = bar;
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalStoreThroughputTest.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalStoreThroughputTest.java
new file mode 100644
index 0000000000..eeb566f182
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalStoreThroughputTest.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal.performance;
+
+import java.io.IOException;
+import java.util.UUID;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.persistence.store.journal.JournalShutdownException;
+import org.apache.tuscany.persistence.store.journal.JournalStore;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serialize;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeRecordId;
+import org.apache.tuscany.persistence.store.journal.TestUtils;
+
+/**
+ * Runs a basic throughput tests on JournalStore operations
+ * <p/>
+ * TODO this should be integrated with a Maven itest-based performance harness
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalStoreThroughputTest {
+ private static final int SIZE = 1000;
+ private CyclicBarrier barrier;
+ private JournalStore store;
+ private long now;
+ private SCAObject owner = new MockSCAObject();
+ private String id = UUID.randomUUID().toString();
+ private CountDownLatch latch = new CountDownLatch(1);
+ private long expire = System.currentTimeMillis() + 10000;
+ private Foo object = new Foo("this is a test", 1);
+
+ public static void main(String[] args) throws Exception {
+ JournalStoreThroughputTest test = new JournalStoreThroughputTest();
+ test.testAppend();
+ test.latch.await(5000, TimeUnit.MILLISECONDS);
+ }
+
+ public void testAppend() throws Exception {
+ TestUtils.cleanupLog();
+ store = new JournalStore(new MockMonitor());
+ store.init();
+ final Thread[] threads = new Thread[SIZE];
+ barrier = new CyclicBarrier(SIZE, new Runnable() {
+ public void run() {
+ try {
+ System.out.println("-----------------------------------------------------");
+ System.out.println("JournalStore.append()");
+ byte[] idBytes = serializeRecordId(owner.getUri().toString(), id);
+ byte[] bytes = serialize(object);
+ System.out.println("Approx record size :" + (bytes.length + idBytes.length));
+ System.out.println("Total threads :" + barrier.getNumberWaiting());
+ System.out.println("Forced writes :" + barrier.getNumberWaiting());
+ System.out.println("Time:" + (System.currentTimeMillis() - now));
+ store.destroy();
+ latch.countDown();
+ } catch (JournalShutdownException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ for (int i = 0; i < SIZE; i++) {
+ threads[i] = new Thread(new InsertWorker(true));
+ }
+ now = System.currentTimeMillis();
+ for (int i = 0; i < SIZE; i++) {
+ threads[i].start();
+ }
+ }
+
+ private class InsertWorker implements Runnable {
+ boolean forced;
+
+ public InsertWorker(boolean forced) {
+ this.forced = forced;
+ }
+
+ public void run() {
+ try {
+ store.insertRecord(owner, id, object, expire);
+ barrier.await();
+ } catch (StoreWriteException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalThroughputTest.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalThroughputTest.java
new file mode 100644
index 0000000000..7a3e8fa308
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/JournalThroughputTest.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal.performance;
+
+import java.io.IOException;
+import java.util.UUID;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.persistence.store.journal.Journal;
+import static org.apache.tuscany.persistence.store.journal.SerializationHelper.serializeRecordId;
+import org.apache.tuscany.persistence.store.journal.TestUtils;
+
+/**
+ * Runs a basic throughput tests on Journal operations
+ * <p/>
+ * TODO this should be integrated with a Maven itest-based performance harness
+ *
+ * @version $Rev$ $Date$
+ */
+public class JournalThroughputTest {
+ private static final int SIZE = 1000;
+ private CyclicBarrier barrier;
+ private Journal journal;
+ private byte[] bytes;
+ private byte[] recordId;
+ private long now;
+ private CountDownLatch latch = new CountDownLatch(1);
+
+ public static void main(String[] args) throws Exception {
+ JournalThroughputTest test = new JournalThroughputTest();
+ test.testForcedWrites();
+ test.latch.await(5000, TimeUnit.MILLISECONDS);
+ test.testNonForcedWrites();
+ }
+
+ public void testForcedWrites() throws Exception {
+ TestUtils.cleanupLog();
+ journal = new Journal();
+ journal.open();
+ recordId = serializeRecordId("foo", UUID.randomUUID().toString());
+ bytes = "this is a test".getBytes();
+ final Thread[] threads = new Thread[SIZE];
+ barrier = new CyclicBarrier(SIZE, new Runnable() {
+ public void run() {
+ System.out.println("-----------------------------------------------------");
+ System.out.println("Journal.writeBlock() using forced writes");
+ System.out.println("Approx record size :" + (recordId.length + bytes.length));
+ System.out.println("Total threads :" + barrier.getNumberWaiting());
+ System.out.println("Forced writes :" + barrier.getNumberWaiting());
+ System.out.println("Time:" + (System.currentTimeMillis() - now));
+ try {
+ journal.close();
+ latch.countDown();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ for (int i = 0; i < SIZE; i++) {
+ threads[i] = new Thread(new Worker(true));
+ }
+ now = System.currentTimeMillis();
+ for (int i = 0; i < SIZE; i++) {
+ threads[i].start();
+ }
+ }
+
+ public void testNonForcedWrites() throws Exception {
+ TestUtils.cleanupLog();
+ journal = new Journal();
+ journal.open();
+ recordId = serializeRecordId("foo", UUID.randomUUID().toString());
+ bytes = "this is a test".getBytes();
+ final Thread[] threads = new Thread[SIZE];
+ barrier = new CyclicBarrier(SIZE, new Runnable() {
+ public void run() {
+ System.out.println("-----------------------------------------------------");
+ System.out.println("Journal.writeBlock() using non-forced writes");
+ System.out.println("Approx record size :" + (recordId.length + bytes.length));
+ System.out.println("Total threads :" + barrier.getNumberWaiting());
+ System.out.println("Forced writes :" + barrier.getNumberWaiting());
+ System.out.println("Time:" + (System.currentTimeMillis() - now));
+ System.out.println("-----------------------------------------------------");
+ try {
+ journal.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ for (int i = 0; i < SIZE; i++) {
+ threads[i] = new Thread(new Worker(false));
+ }
+ now = System.currentTimeMillis();
+ for (int i = 0; i < SIZE; i++) {
+ threads[i].start();
+ }
+ }
+
+ private class Worker implements Runnable {
+ boolean forced;
+
+ public Worker(boolean forced) {
+ this.forced = forced;
+ }
+
+ public void run() {
+ try {
+ journal.writeBlock(bytes, recordId, forced);
+ barrier.await();
+ } catch (StoreWriteException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockMonitor.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockMonitor.java
new file mode 100644
index 0000000000..a62630ebe0
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockMonitor.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal.performance;
+
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockMonitor implements StoreMonitor {
+ @LogLevel("DEBUG")
+ public void start(String msg) {
+
+ }
+
+ @LogLevel("DEBUG")
+ public void stop(String msg) {
+
+ }
+
+ @LogLevel("DEBUG")
+ public void beginRecover() {
+
+ }
+
+ @LogLevel("DEBUG")
+ public void endRecover() {
+
+ }
+
+ @LogLevel("DEBUG")
+ public void recover(Object recordId) {
+
+ }
+
+ @LogLevel("ERROR")
+ public void error(Throwable e) {
+
+ }
+}
diff --git a/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockSCAObject.java b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockSCAObject.java
new file mode 100644
index 0000000000..e9ecdbab28
--- /dev/null
+++ b/sandbox/old/contrib/persistence/store.journal/src/test/java/org/apache/tuscany/persistence/store/journal/performance/MockSCAObject.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.persistence.store.journal.performance;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.EventFilter;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockSCAObject implements SCAObject {
+
+ public URI getUri() {
+ return null;
+ }
+
+ public void publish(Event object) {
+
+ }
+
+ public void addListener(RuntimeEventListener listener) {
+
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+
+ }
+
+ public int getLifecycleState() {
+ return 0;
+ }
+
+ public void start() throws CoreRuntimeException {
+
+ }
+
+ public void stop() throws CoreRuntimeException {
+
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/LICENSE.txt b/sandbox/old/contrib/repository-maven/LICENSE.txt
new file mode 100644
index 0000000000..75b52484ea
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/contrib/repository-maven/NOTICE.txt b/sandbox/old/contrib/repository-maven/NOTICE.txt
new file mode 100644
index 0000000000..ecc68a9614
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/repository-maven/pom.xml.off b/sandbox/old/contrib/repository-maven/pom.xml.off
new file mode 100644
index 0000000000..99f0575d61
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/pom.xml.off
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>services</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>maven</artifactId>
+ <name>Apache Tuscany Maven Service</name>
+ <description>Tuscany Maven Service</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-embedder</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenArtifactRepository.java b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenArtifactRepository.java
new file mode 100644
index 0000000000..517565b17b
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenArtifactRepository.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * Artifact repository used for resolving artifacts.
+ * <p/>
+ * This is used by the composite loader for resolving artifacts transitively. The repository uses the Maven API for
+ * resolving dependencies and hence expects the artifacts to be stored in a structure similar to the Maven repository
+ * layout. The repository first looks within the deployed unit (WAR for example), before resorting to a local and set of
+ * remote Maven repositories.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MavenArtifactRepository implements ArtifactRepository {
+
+ /**
+ * Maven helper
+ */
+ private MavenHelper mavenHelper;
+
+ /**
+ * WAR repository helper
+ */
+ private WarRepositoryHelper warRepositoryHelper;
+
+ /**
+ * Conctructs a new artifact repository.
+ */
+ public MavenArtifactRepository(@Property(name = "remoteRepoUrl")
+ String remoteRepoUrl, @Reference
+ RuntimeInfo runtimeInfo) {
+ mavenHelper = new MavenHelper(remoteRepoUrl, runtimeInfo.isOnline());
+ warRepositoryHelper = new WarRepositoryHelper(runtimeInfo.getBaseURL());
+ mavenHelper.start();
+ }
+
+ /**
+ * Resolve an artifact. This ensures that the information associated with an artifact is fully populated;
+ * Specifically, after this operation the URL should contain a location where the artifact can be obtained.
+ *
+ * @param rootArtifact the artifact to be resolved
+ */
+ public void resolve(Artifact rootArtifact) {
+ if (warRepositoryHelper.resolveTransitively(rootArtifact)) {
+ return;
+ }
+ if (mavenHelper.resolveTransitively(rootArtifact)) {
+ return;
+ }
+ throw new TuscanyDependencyException("Unable to resolve artifact", rootArtifact.toString());
+ }
+
+ /**
+ * Resolve a collection of Artifacts.
+ *
+ * @param artifacts a collection of artifacts to be resolved
+ * @see #resolve(Artifact)
+ */
+ public void resolve(Collection<? extends Artifact> artifacts) {
+ for (Artifact artifact : artifacts) {
+ resolve(artifact);
+ }
+ }
+
+ /**
+ * Destroy method.
+ */
+ @Destroy
+ public void destroy() {
+ mavenHelper.stop();
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenHelper.java b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenHelper.java
new file mode 100644
index 0000000000..f82756afbd
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/MavenHelper.java
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.settings.MavenSettingsBuilder;
+import org.apache.maven.settings.Settings;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.codehaus.classworlds.ClassWorld;
+import org.codehaus.classworlds.DefaultClassRealm;
+import org.codehaus.classworlds.DuplicateRealmException;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.embed.Embedder;
+
+/**
+ * Utility class for embedding Maven.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MavenHelper {
+
+ /** Local repository */
+// private static final File LOCAL_REPO = new File(System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository");
+
+ /** Remote repository URLs */
+ private final String[] remoteRepositoryUrls;
+
+ /** Maven metadata source */
+ private ArtifactMetadataSource metadataSource;
+
+ /** Artifact factory */
+ private ArtifactFactory artifactFactory;
+
+ /** Local artifact repository */
+ private ArtifactRepository localRepository;
+
+ /** Remote artifact repositories */
+ private List<ArtifactRepository> remoteRepositories = new LinkedList<ArtifactRepository>();
+
+ /** Artifact resolver */
+ private ArtifactResolver artifactResolver;
+
+ /** Online */
+ private boolean online;
+
+ /**
+ * Initialize the remote repository URLs.
+ *
+ * @param remoteRepositoryUrls
+ * Remote repository URLS.
+ * @param runtimeInfo
+ * Runtime information.
+ */
+ public MavenHelper(String remoteRepositoryUrl, boolean online) {
+ this.remoteRepositoryUrls = remoteRepositoryUrl.split(",");
+ this.online = online;
+ }
+
+ /**
+ * Starts the embedder.
+ *
+ * @throws TuscanyDependencyException
+ * If unable to start the embedder.
+ */
+ public void start() throws TuscanyDependencyException {
+
+ try {
+
+ Embedder embedder = new Embedder();
+ ClassWorld classWorld = new ClassWorld();
+
+ classWorld.newRealm("plexus.core", getClass().getClassLoader());
+
+ // Evil hack for Tomcat classloader issue - starts
+ Field realmsField = ClassWorld.class.getDeclaredField("realms");
+ realmsField.setAccessible(true);
+ Map realms = (Map) realmsField.get(classWorld);
+ DefaultClassRealm realm = (DefaultClassRealm) realms.get("plexus.core");
+
+ Class clazz = Class.forName("org.codehaus.classworlds.RealmClassLoader");
+ Constructor ctr = clazz.getDeclaredConstructor(new Class[] { DefaultClassRealm.class, ClassLoader.class });
+ ctr.setAccessible(true);
+ Object realmClassLoader = ctr.newInstance(realm, getClass().getClassLoader());
+
+ Field realmClassLoaderField = DefaultClassRealm.class.getDeclaredField("classLoader");
+ realmClassLoaderField.setAccessible(true);
+ realmClassLoaderField.set(realm, realmClassLoader);
+ // Evil hack for Tomcat classloader issue - ends
+
+ embedder.start(classWorld);
+
+ metadataSource = (ArtifactMetadataSource) embedder.lookup(ArtifactMetadataSource.ROLE);
+ artifactFactory = (ArtifactFactory) embedder.lookup(ArtifactFactory.ROLE);
+ artifactResolver = (ArtifactResolver) embedder.lookup(ArtifactResolver.ROLE);
+
+ setUpRepositories(embedder);
+
+ embedder.stop();
+
+ } catch (DuplicateRealmException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (PlexusContainerException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (ComponentLookupException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (NoSuchFieldException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (ClassNotFoundException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (NoSuchMethodException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (InstantiationException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new TuscanyDependencyException(ex);
+ }
+
+ }
+
+ /**
+ * Stops the embedder.
+ *
+ * @throws TuscanyDependencyException
+ * If unable to stop the embedder.
+ */
+ public void stop() throws TuscanyDependencyException {
+ }
+
+ /**
+ * Resolves the dependencies transitively.
+ *
+ * @param artifact
+ * Artifact whose dependencies need to be resolved.
+ * @throws TuscanyDependencyException
+ * If unable to resolve the dependencies.
+ */
+ public boolean resolveTransitively(Artifact rootArtifact) throws TuscanyDependencyException {
+
+ org.apache.maven.artifact.Artifact mavenRootArtifact = artifactFactory.createArtifact(rootArtifact.getGroup(), rootArtifact.getName(),
+ rootArtifact.getVersion(), org.apache.maven.artifact.Artifact.SCOPE_RUNTIME, rootArtifact.getType());
+
+ try {
+
+ if (resolve(mavenRootArtifact)) {
+ rootArtifact.setUrl(mavenRootArtifact.getFile().toURL());
+ if (resolveDependencies(rootArtifact, mavenRootArtifact)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ } catch (MalformedURLException ex) {
+ throw new TuscanyDependencyException(ex);
+ }
+
+ }
+
+ /*
+ * Resolves the artifact.
+ */
+ private boolean resolve(org.apache.maven.artifact.Artifact mavenRootArtifact) {
+
+ try {
+ artifactResolver.resolve(mavenRootArtifact, remoteRepositories, localRepository);
+ return true;
+ } catch (ArtifactResolutionException ex) {
+ return false;
+ } catch (ArtifactNotFoundException ex) {
+ return false;
+ }
+
+ }
+
+ /*
+ * Sets up local and remote repositories.
+ */
+ private void setUpRepositories(Embedder embedder) {
+
+ try {
+
+ ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup(ArtifactRepositoryFactory.ROLE);
+
+ ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) embedder.lookup(ArtifactRepositoryLayout.ROLE, "default");
+
+ String updatePolicy = online ? ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS : ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER;
+ ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy(true, updatePolicy, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
+ ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy(true, updatePolicy, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);
+
+ MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder)embedder.lookup(MavenSettingsBuilder.ROLE);
+ Settings settings = settingsBuilder.buildSettings();
+ String localRepo = settings.getLocalRepository();
+
+ localRepository = artifactRepositoryFactory.createArtifactRepository("local", new File(localRepo).toURL().toString(), layout,
+ snapshotsPolicy, releasesPolicy);
+
+ if (!online) {
+ return;
+ }
+
+ for (String remoteRepositoryUrl : remoteRepositoryUrls) {
+ String repoid = remoteRepositoryUrl.replace(':', '_');
+ repoid = repoid.replace('/', '_');
+ repoid = repoid.replace('\\', '_');
+ remoteRepositories.add(artifactRepositoryFactory.createArtifactRepository(repoid, remoteRepositoryUrl, layout, snapshotsPolicy,
+ releasesPolicy));
+ }
+
+ } catch (Exception ex) {
+ throw new TuscanyDependencyException(ex);
+ }
+
+ }
+
+ /*
+ * Resolves transitive dependencies.
+ */
+ private boolean resolveDependencies(Artifact rootArtifact, org.apache.maven.artifact.Artifact mavenRootArtifact) {
+
+ try {
+
+ ResolutionGroup resolutionGroup = null;
+ ArtifactResolutionResult result = null;
+
+ resolutionGroup = metadataSource.retrieve(mavenRootArtifact, localRepository, remoteRepositories);
+ result = artifactResolver.resolveTransitively(resolutionGroup.getArtifacts(), mavenRootArtifact, remoteRepositories, localRepository,
+ metadataSource);
+
+ // Add the artifacts to the deployment unit
+ for (Object obj : result.getArtifacts()) {
+ org.apache.maven.artifact.Artifact depArtifact = (org.apache.maven.artifact.Artifact) obj;
+ Artifact artifact = new Artifact();
+ artifact.setName(depArtifact.getArtifactId());
+ artifact.setGroup(depArtifact.getGroupId());
+ artifact.setType(depArtifact.getType());
+ artifact.setVersion(depArtifact.getVersion());
+ artifact.setClassifier(depArtifact.getClassifier());
+ artifact.setUrl(depArtifact.getFile().toURL());
+ rootArtifact.addDependency(artifact);
+ }
+
+ } catch (ArtifactMetadataRetrievalException ex) {
+ return false;
+ } catch (MalformedURLException ex) {
+ throw new TuscanyDependencyException(ex);
+ } catch (ArtifactResolutionException ex) {
+ return false;
+ } catch (ArtifactNotFoundException ex) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/TuscanyDependencyException.java b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/TuscanyDependencyException.java
new file mode 100644
index 0000000000..a7817ff3be
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/TuscanyDependencyException.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception thrown in case of an artifact error.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyDependencyException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the cause.
+ *
+ * @param cause Cause of the exception.
+ */
+ public TuscanyDependencyException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Initializes the message.
+ *
+ * @param message Message of the exception.
+ */
+ public TuscanyDependencyException(String message) {
+ super(message);
+ }
+
+
+ /**
+ * Initializes the message.
+ *
+ * @param message Message of the exception.
+ * @param identifier an identifier for the exeption.
+ */
+ public TuscanyDependencyException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/WarRepositoryHelper.java b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/WarRepositoryHelper.java
new file mode 100644
index 0000000000..6b3ba3ed10
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/main/java/org/apache/tuscany/services/maven/WarRepositoryHelper.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import java.beans.XMLDecoder;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.codehaus.plexus.util.IOUtil;
+
+/**
+ * Helper class for resolving dependencies from WAR files.
+ *
+ * @author Administrator
+ *
+ */
+public class WarRepositoryHelper {
+
+ /** WAR Repository URL */
+ private URL reporsitoryUrl;
+
+ /** Dependency metadata */
+ private Map<String, Set<String>> transDependencyMap = new HashMap<String, Set<String>>();
+
+ /**
+ * Initializes the repository URL.
+ * @param baseUrl Base URL.
+ */
+ @SuppressWarnings("unchecked")
+ public WarRepositoryHelper(URL baseUrl) {
+
+
+ InputStream transDepMapInputStream = null;
+ try {
+
+ reporsitoryUrl = new URL(baseUrl, "repository/");
+ URL transDependencyMapUrl = new URL(baseUrl, "repository/dependency.metadata");
+ transDepMapInputStream = transDependencyMapUrl.openStream();
+
+ XMLDecoder decoder = new XMLDecoder(transDepMapInputStream);
+ transDependencyMap = (Map<String, Set<String>>)decoder.readObject();
+ decoder.close();
+
+ } catch (MalformedURLException ex) {
+ // throw new TuscanyDependencyException(ex);
+ } catch (IOException ex) {
+ // throw new TuscanyDependencyException(ex);
+ } finally {
+ IOUtil.close(transDepMapInputStream);
+ }
+
+ }
+
+ /**
+ * Resolves the dependencies transitively.
+ *
+ * @param artifact
+ * Artifact whose dependencies need to be resolved.
+ * @throws TuscanyDependencyException
+ * If unable to resolve the dependencies.
+ */
+ public boolean resolveTransitively(Artifact rootArtifact) throws TuscanyDependencyException {
+
+ String artKey = rootArtifact.getGroup() + "/" + rootArtifact.getName() + "/" + rootArtifact.getVersion() + "/";
+ if(!transDependencyMap.containsKey(artKey)) {
+ return false;
+ }
+
+
+ for(String dep : transDependencyMap.get(artKey)) {
+
+ String[] tokens = dep.split("/");
+ String artName = tokens[1];
+
+ try {
+ if(artName.equals(rootArtifact.getName())) {
+ rootArtifact.setUrl(new URL(reporsitoryUrl, dep));
+ } else {
+ Artifact depArtifact = new Artifact();
+ depArtifact.setGroup(tokens[0]);
+ depArtifact.setName(tokens[1]);
+ depArtifact.setVersion(tokens[2]);
+ depArtifact.setUrl(new URL(reporsitoryUrl, dep));
+ rootArtifact.addDependency(depArtifact);
+
+ }
+ } catch (MalformedURLException ex) {
+ throw new TuscanyDependencyException(ex);
+ }
+ }
+ return rootArtifact.getUrl()!=null;
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/MavenArtifactRepositoryTestCase.java b/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/MavenArtifactRepositoryTestCase.java
new file mode 100644
index 0000000000..b4e9babd05
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/MavenArtifactRepositoryTestCase.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URI;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenArtifactRepositoryTestCase extends TestCase {
+
+ public MavenArtifactRepositoryTestCase(String arg0) {
+ super(arg0);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.apache.tuscany.serviceBindings.maven.MavenArtifactRepository.resolve(Artifact)'
+ */
+ public void testResolveArtifact() throws Exception {
+
+ final URL BASE_URL = new File(System.getProperty("user.home") + File.separator + ".m2").toURL();
+ String remoteRepoUrl = "http://repo1.maven.org/maven2/";
+ MavenArtifactRepository repository = new MavenArtifactRepository(remoteRepoUrl, new RuntimeInfo() {
+ public File getApplicationRootDirectory() {
+ return null;
+ }
+
+ public URL getBaseURL() {
+ return BASE_URL;
+ }
+
+ public File getInstallDirectory() {
+ return null;
+ }
+
+ public boolean isOnline() {
+ return false;
+ }
+
+ public URI getDomain() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRuntimeId() {
+ throw new UnsupportedOperationException();
+ }
+ });
+ Artifact artifact = new Artifact();
+ artifact.setGroup("junit");
+ artifact.setName("junit");
+ artifact.setVersion("3.8.1");
+ artifact.setType("jar");
+
+ repository.resolve(artifact);
+
+ Set<URL> urls = artifact.getUrls();
+
+ System.err.println(urls);
+
+ assertEquals(1, urls.size());
+
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/WarRepositoryHelperTestCase.java b/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/WarRepositoryHelperTestCase.java
new file mode 100644
index 0000000000..3a79599fa7
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/test/java/org/apache/tuscany/services/maven/WarRepositoryHelperTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.services.maven;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.apache.tuscany.spi.services.artifact.Artifact;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Administrator
+ *
+ */
+public class WarRepositoryHelperTestCase extends TestCase {
+
+ /**
+ * @param arg0
+ */
+ public WarRepositoryHelperTestCase(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Test method for {@link org.apache.tuscany.services.maven.WarRepositoryHelper#WarRepositoryHelper(java.net.URL)}.
+ */
+ public void testWarRepositoryHelper() {
+
+ URL warUrl = getClass().getClassLoader().getResource("webapp.war");
+ URLClassLoader urlc = new URLClassLoader(new URL[] {warUrl});
+
+ URL repoUrl = urlc.getResource("WEB-INF/tuscany/");
+ System.err.println(repoUrl);
+
+ WarRepositoryHelper warRepositoryHelper = new WarRepositoryHelper(repoUrl);
+ assertNotNull(warRepositoryHelper);
+
+ }
+
+ /**
+ * Test method for {@link org.apache.tuscany.services.maven.WarRepositoryHelper#WarRepositoryHelper(java.net.URL)}.
+ */
+ public void testResolveTransitively() {
+
+ URL warUrl = getClass().getClassLoader().getResource("webapp.war");
+ URLClassLoader urlc = new URLClassLoader(new URL[] {warUrl});
+
+ URL repoUrl = urlc.getResource("WEB-INF/tuscany/");
+ WarRepositoryHelper warRepositoryHelper = new WarRepositoryHelper(repoUrl);
+
+ Artifact artifact = new Artifact();
+ artifact.setGroup("commons-httpclient");
+ artifact.setName("commons-httpclient");
+ artifact.setVersion("3.0");
+
+ warRepositoryHelper.resolveTransitively(artifact);
+ assertEquals(4, artifact.getUrls().size());
+
+ }
+
+}
diff --git a/sandbox/old/contrib/repository-maven/src/test/resources/webapp.war b/sandbox/old/contrib/repository-maven/src/test/resources/webapp.war
new file mode 100644
index 0000000000..4448aca8ff
--- /dev/null
+++ b/sandbox/old/contrib/repository-maven/src/test/resources/webapp.war
Binary files differ
diff --git a/sandbox/old/contrib/runtime-itest/plugin/LICENSE.txt b/sandbox/old/contrib/runtime-itest/plugin/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/runtime-itest/plugin/NOTICE.txt b/sandbox/old/contrib/runtime-itest/plugin/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-itest/plugin/pom.xml.off b/sandbox/old/contrib/runtime-itest/plugin/pom.xml.off
new file mode 100644
index 0000000000..b196938b57
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/pom.xml.off
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Integration Test Plugin</name>
+ <description>A plugin for Apache Maven that simplifies integration testing of SCA components.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit</artifactId>
+ <version>2.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <url>scp://people.apache.org/www/incubator.apache.org/tuscany/plugins/tuscany-itest-plugin</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/Dependency.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/Dependency.java
new file mode 100644
index 0000000000..4f3f6b0f10
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/Dependency.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+
+/**
+ * Represents a configured tuscany dependency for boot and extension libraries.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Dependency {
+
+ /**
+ * JAR type artifact.
+ */
+ private static final String TYPE_JAR = "jar";
+
+ /**
+ * Group Id that is injected in from configuration.
+ */
+ private String groupId;
+
+ /**
+ * Artifact Id that is injected in from configuration.
+ */
+ private String artifactId;
+
+ /**
+ * Version that is injected in from configuration.
+ */
+ private String version;
+
+ /**
+ * Default constructor.
+ */
+ public Dependency() {
+ }
+
+ /**
+ * Initializes the field.
+ *
+ * @param groupId Group id.
+ * @param artifactId Artifact id.
+ * @param version Artifact version.
+ */
+ public Dependency(String groupId, String artifactId, String version) {
+ super();
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+
+ /**
+ * Gets the artifact using the specified artifact factory.
+ *
+ * @param artifactFactory Artifact factory to use.
+ * @return Artifact identified by the dependency.
+ */
+ public Artifact getArtifact(ArtifactFactory artifactFactory) {
+ return artifactFactory.createArtifact(groupId, artifactId, version, Artifact.SCOPE_RUNTIME, TYPE_JAR);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedArtifactRepository.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedArtifactRepository.java
new file mode 100644
index 0000000000..282099062d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedArtifactRepository.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenEmbeddedArtifactRepository implements org.apache.tuscany.spi.services.artifact.ArtifactRepository {
+ public static final URI COMPONENT_NAME = URI.create("MavenEmbeddedArtifactRepository");
+
+ private ArtifactFactory artifactFactory;
+ private ArtifactResolver resolver;
+ private ArtifactMetadataSource metadataSource;
+ private ArtifactRepository localRepository;
+ private List remoteRepositories;
+
+ public MavenEmbeddedArtifactRepository(ArtifactFactory artifactFactory,
+ ArtifactResolver resolver,
+ ArtifactMetadataSource metadataSource,
+ ArtifactRepository localRepository,
+ List remoteRepositories) {
+ this.artifactFactory = artifactFactory;
+ this.resolver = resolver;
+ this.metadataSource = metadataSource;
+ this.localRepository = localRepository;
+ this.remoteRepositories = remoteRepositories;
+ }
+
+ public void resolve(org.apache.tuscany.spi.services.artifact.Artifact artifact) {
+ resolveTransitively(artifact);
+ }
+
+ public void resolve(Collection artifacts) {
+ for (Object a : artifacts) {
+ resolve((Artifact) a);
+ }
+ }
+
+ /**
+ * Resolves the dependencies transitively.
+ *
+ * @param rootArtifact Artifact whose dependencies need to be resolved.
+ * @return true if all dependencies were resolved
+ */
+ public boolean resolveTransitively(org.apache.tuscany.spi.services.artifact.Artifact rootArtifact) {
+
+ Artifact mavenRootArtifact =
+ artifactFactory.createArtifact(rootArtifact.getGroup(), rootArtifact.getName(), rootArtifact
+ .getVersion(), Artifact.SCOPE_RUNTIME, rootArtifact.getType());
+
+ try {
+
+ if (resolve(mavenRootArtifact)) {
+ rootArtifact.setUrl(mavenRootArtifact.getFile().toURL());
+ return resolveDependencies(rootArtifact, mavenRootArtifact);
+ } else {
+ return false;
+ }
+ } catch (MalformedURLException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+
+ }
+
+ /*
+ * Resolves the artifact.
+ */
+ private boolean resolve(Artifact mavenRootArtifact) {
+
+ try {
+ resolver.resolve(mavenRootArtifact, remoteRepositories, localRepository);
+ return true;
+ } catch (ArtifactResolutionException ex) {
+ return false;
+ } catch (ArtifactNotFoundException ex) {
+ return false;
+ }
+
+ }
+
+ /*
+ * Resolves transitive dependencies.
+ */
+ private boolean resolveDependencies(org.apache.tuscany.spi.services.artifact.Artifact rootArtifact,
+ Artifact mavenRootArtifact) {
+
+ try {
+
+ ResolutionGroup resolutionGroup = metadataSource.retrieve(mavenRootArtifact,
+ localRepository,
+ remoteRepositories);
+
+ ArtifactResolutionResult result = resolver.resolveTransitively(resolutionGroup.getArtifacts(),
+ mavenRootArtifact,
+ remoteRepositories,
+ localRepository,
+ metadataSource);
+
+ // Add the artifacts to the deployment unit
+ for (Object obj : result.getArtifacts()) {
+ Artifact depArtifact = (Artifact) obj;
+ org.apache.tuscany.spi.services.artifact.Artifact artifact =
+ new org.apache.tuscany.spi.services.artifact.Artifact();
+ artifact.setName(depArtifact.getArtifactId());
+ artifact.setGroup(depArtifact.getGroupId());
+ artifact.setType(depArtifact.getType());
+ artifact.setClassifier(depArtifact.getClassifier());
+ artifact.setUrl(depArtifact.getFile().toURL());
+ artifact.setVersion(depArtifact.getVersion());
+ rootArtifact.addDependency(artifact);
+ }
+
+ } catch (ArtifactMetadataRetrievalException ex) {
+ return false;
+ } catch (MalformedURLException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (ArtifactResolutionException ex) {
+ return false;
+ } catch (ArtifactNotFoundException ex) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java
new file mode 100644
index 0000000000..407b07e72e
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.net.URI;
+import java.util.Collection;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.GroupInitializationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.core.component.SimpleWorkContext;
+import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.runtime.InitializationException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenEmbeddedRuntime extends AbstractRuntime<MavenRuntimeInfo> {
+ private ArtifactRepository artifactRepository;
+
+ public MavenEmbeddedRuntime(Log log) {
+ super(MavenRuntimeInfo.class);
+ MonitorFactory monitorFactory = new MavenMonitorFactory(log);
+ setMonitorFactory(monitorFactory);
+ }
+
+ protected void registerBaselineSystemComponents() throws InitializationException {
+ super.registerBaselineSystemComponents();
+ registerSystemComponent(MavenEmbeddedArtifactRepository.COMPONENT_NAME,
+ ArtifactRepository.class,
+ artifactRepository);
+ }
+
+ public void setArtifactRepository(ArtifactRepository artifactRepository) {
+ this.artifactRepository = artifactRepository;
+ }
+
+ public Collection<Component> deployTestScdl(ComponentDefinition<CompositeImplementation> definition)
+ throws Exception {
+ Deployer deployer = getDeployer();
+ return deployer.deploy(null, definition);
+ }
+
+ public void startContext(URI compositeId) throws GroupInitializationException {
+ getScopeRegistry().getScopeContainer(Scope.COMPOSITE).startContext(compositeId, compositeId);
+ }
+
+ public void executeTest(URI contextId, URI componentId, Operation<?> operation) throws Exception {
+ Component testComponent = getComponentManager().getComponent(componentId);
+ TargetInvoker targetInvoker = testComponent.createTargetInvoker("testService", operation);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, contextId);
+ WorkContext workContext = new SimpleWorkContext();
+ workContext.setIdentifier(Scope.COMPOSITE, contextId);
+ PojoWorkContextTunnel.setThreadWorkContext(workContext);
+ try {
+ targetInvoker.invokeTarget(null, TargetInvoker.NONE, workContext);
+ } finally {
+ getWorkContext().clearIdentifier(Scope.COMPOSITE);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenMonitorFactory.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenMonitorFactory.java
new file mode 100644
index 0000000000..0fd4aa7d59
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenMonitorFactory.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.text.MessageFormat;
+
+import org.apache.maven.plugin.logging.Log;
+
+import org.apache.tuscany.core.monitor.ProxyMonitorFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenMonitorFactory extends ProxyMonitorFactory {
+ private final Log log;
+
+ public MavenMonitorFactory(Log log) {
+ this.log = log;
+ Map<String, Object> configProperties = new HashMap<String, Object>();
+ configProperties.put("defaultLevel", Level.FINEST);
+ initInternal(configProperties);
+ }
+
+ protected <T> InvocationHandler createInvocationHandler(Class<T> monitorInterface, Map<String, Level> levels) {
+ ResourceBundle bundle = locateBundle(monitorInterface, bundleName);
+ return new MonitorHandler(monitorInterface.getName(), levels, bundle);
+ }
+
+ private class MonitorHandler implements InvocationHandler {
+ private final String monitorName;
+ private final Map<String, Level> methodLevels;
+ private final ResourceBundle bundle;
+
+ public MonitorHandler(String monitorName, Map<String, Level> methodLevels, ResourceBundle bundle) {
+ this.monitorName = monitorName;
+ this.methodLevels = methodLevels;
+ this.bundle = bundle;
+ }
+
+ public Object invoke(Object object, Method method, Object[] objects) throws Throwable {
+ String sourceMethod = method.getName();
+ Level level = methodLevels.get(sourceMethod);
+ if (level == Level.OFF) {
+ return null;
+ }
+
+ int value = level.intValue();
+ if (isLogEnabled(value)) {
+ String key = monitorName + '#' + sourceMethod;
+ String message;
+ if (bundle != null) {
+ message = bundle.getString(key);
+ } else {
+ message = null;
+ }
+ if (message != null) {
+ message = MessageFormat.format(message, objects);
+ } else {
+ StringBuilder builder = new StringBuilder();
+ builder.append(key).append(":");
+ for (Object o : objects) {
+ builder.append(' ');
+ if (o instanceof Throwable) {
+ builder.append(formatException((Throwable) o));
+ } else {
+ builder.append(String.valueOf(o));
+ }
+ }
+ message = builder.toString();
+ }
+ Throwable cause = getFirstException(objects);
+ if (cause != null) {
+ if (value >= Level.SEVERE.intValue()) {
+ log.error(message, cause);
+ } else if (value >= Level.WARNING.intValue()) {
+ log.warn(message, cause);
+ } else if (value >= Level.INFO.intValue()) {
+ log.info(message, cause);
+ } else if (value >= Level.FINEST.intValue()) {
+ log.debug(message, cause);
+ }
+ } else {
+ if (value >= Level.SEVERE.intValue()) {
+ log.error(message);
+ } else if (value >= Level.WARNING.intValue()) {
+ log.warn(message);
+ } else if (value >= Level.INFO.intValue()) {
+ log.info(message);
+ } else if (value >= Level.FINEST.intValue()) {
+ log.debug(message);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private boolean isLogEnabled(int value) {
+ return log.isDebugEnabled() && value >= Level.FINEST.intValue()
+ || log.isInfoEnabled() && value >= Level.INFO.intValue()
+ || log.isWarnEnabled() && value >= Level.WARNING.intValue()
+ || log.isErrorEnabled() && value >= Level.SEVERE.intValue();
+ }
+
+ private Throwable getFirstException(Object[] objects) {
+ for (Object object : objects) {
+ if (object instanceof Throwable) {
+ return (Throwable) object;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenRuntimeInfo.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenRuntimeInfo.java
new file mode 100644
index 0000000000..f6a4e1f52c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenRuntimeInfo.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URI;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenRuntimeInfo implements RuntimeInfo {
+ public static final URI COMPONENT_NAME = URI.create("MavenRuntimeInfo");
+
+ public File getInstallDirectory() {
+ throw new UnsupportedOperationException();
+ }
+
+ public File getApplicationRootDirectory() {
+ throw new UnsupportedOperationException();
+ }
+
+ public URL getBaseURL() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isOnline() {
+ throw new UnsupportedOperationException();
+ }
+
+ public URI getDomain() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRuntimeId() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java
new file mode 100644
index 0000000000..9e3d0d3f55
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.util.Collection;
+import java.net.URI;
+
+import org.apache.maven.surefire.testset.SurefireTestSet;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.StackTraceWriter;
+import org.apache.maven.surefire.report.PojoStackTraceWriter;
+
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCATestSet implements SurefireTestSet {
+ private final MavenEmbeddedRuntime runtime;
+ private final String name;
+ private final URI contextId;
+ private final URI componentId;
+ private final Collection<? extends Operation<?>> operations;
+
+ public SCATestSet(MavenEmbeddedRuntime runtime,
+ String name,
+ URI contextId,
+ URI uri,
+ Collection<? extends Operation<?>> operations) {
+ this.runtime = runtime;
+ this.name = name;
+ this.contextId = contextId;
+ this.componentId = uri;
+ this.operations = operations;
+ }
+
+ public void execute(ReporterManager reporterManager, ClassLoader classLoader) throws TestSetFailedException {
+ for (Operation<?> operation : operations) {
+ String operationName = operation.getName();
+ reporterManager.testStarting(new ReportEntry(this, operationName, name));
+ try {
+ runtime.executeTest(contextId, componentId, operation);
+ reporterManager.testSucceeded(new ReportEntry(this, operationName, name));
+ } catch (Exception e) {
+ StackTraceWriter stw = new PojoStackTraceWriter(name, operationName, e);
+ reporterManager.testFailed(new ReportEntry(this, operationName, name, stw));
+ throw new TestSetFailedException(e);
+ }
+ }
+ }
+
+ public int getTestCount() {
+ return operations.size();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class getTestClass() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java
new file mode 100644
index 0000000000..1029b70733
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.maven.surefire.suite.SurefireTestSuite;
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCATestSuite implements SurefireTestSuite {
+ private final Map<String, SCATestSet> testSets = new HashMap<String, SCATestSet>();
+ private int testSetCount = 0;
+ private int testCount = 0;
+
+ public void add(SCATestSet testSet) {
+ testSets.put(testSet.getName(), testSet);
+ testSetCount += 1;
+ testCount += testSet.getTestCount();
+ }
+
+ public int getNumTests() {
+ return testCount;
+ }
+
+ public int getNumTestSets() {
+ return testSetCount;
+ }
+
+ public void execute(ReporterManager reporterManager, ClassLoader classLoader)
+ throws ReporterException, TestSetFailedException {
+ for (SCATestSet testSet : testSets.values()) {
+ execute(testSet, reporterManager, classLoader);
+ }
+ }
+
+ public void execute(String name, ReporterManager reporterManager, ClassLoader classLoader)
+ throws ReporterException, TestSetFailedException {
+ SCATestSet testSet = testSets.get(name);
+ if (testSet == null) {
+ throw new TestSetFailedException("Suite does not contain TestSet: " + name);
+ }
+ execute(testSet, reporterManager, classLoader);
+ }
+
+ protected void execute(SCATestSet testSet, ReporterManager reporterManager, ClassLoader classLoader)
+ throws ReporterException, TestSetFailedException {
+ reporterManager.testSetStarting(new ReportEntry(this, testSet.getName(), "Starting"));
+ testSet.execute(reporterManager, classLoader);
+ reporterManager.testSetCompleted(new ReportEntry(this, testSet.getName(), "Completed"));
+ reporterManager.reset();
+ }
+
+ public Map locateTestSets(ClassLoader classLoader) throws TestSetFailedException {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
new file mode 100644
index 0000000000..78cd505a67
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
@@ -0,0 +1,429 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.surefire.report.BriefConsoleReporter;
+import org.apache.maven.surefire.report.BriefFileReporter;
+import org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.suite.SurefireTestSuite;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.sca.plugin.itest.implementation.junit.ImplementationJUnit;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+
+/**
+ * Integration-tests an SCA composite by running it in local copy of Apache Tuscany
+ * and calling JUnit-based test components to exercise it.
+ *
+ * @version $Rev$ $Date$
+ * @goal test
+ * @phase integration-test
+ */
+public class TuscanyITestMojo extends AbstractMojo {
+ /**
+ * The directory where reports will be written.
+ *
+ * @parameter expression="${project.build.directory}/surefire-reports"
+ */
+ public File reportsDirectory;
+
+ /**
+ * Whether to trim the stack trace in the reports to just the lines within
+ * the test, or show the full trace.
+ *
+ * @parameter expression="${trimStackTrace}" default-value="true"
+ */
+ public boolean trimStackTrace;
+
+ /**
+ * The directory containing generated test classes of the project being tested.
+ *
+ * @parameter expression="${project.build.testOutputDirectory}"
+ * @required
+ */
+ public File testClassesDirectory;
+
+ /**
+ * The SCA domain in which to deploy the test components.
+ *
+ * @parameter expression="itest://localhost/testDomain/"
+ * @required
+ */
+ public String testDomain;
+
+ /**
+ * The name of the component that will be implemented by the test harness composite.
+ *
+ * @parameter expression="testHarness"
+ * @required
+ */
+ public String testComponentName;
+
+ /**
+ * The location if the SCDL that defines the test harness composite.
+ * The source for this would normally be placed in the test/resources
+ * directory and be copied by the resource plugin; this allows property
+ * substitution if required.
+ *
+ * @parameter expression="${project.build.testOutputDirectory}/itest.scdl"
+ */
+ public File testScdl;
+
+ /**
+ * The location of the SCDL that configures the Apache Tuscany runtime.
+ * This allows the default runtime configuration supplied in this plugin
+ * to be overridden.
+ *
+ * @parameter
+ */
+ public URL systemScdl;
+
+ /**
+ * Set of extension artifacts that should be deployed to the runtime.
+ *
+ * @parameter
+ */
+ public Dependency[] extensions;
+
+ /**
+ * @parameter expression="${project.testClasspathElements}"
+ * @required
+ * @readonly
+ */
+ public List<String> testClassPath;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+ * @required
+ * @readonly
+ */
+ public ArtifactResolver resolver;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.metadata.ArtifactMetadataSource}"
+ * @required
+ * @readonly
+ */
+ public ArtifactMetadataSource metadataSource;
+
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ public ArtifactRepository localRepository;
+
+ /**
+ * List of Remote Repositories used by the resolver
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ * @required
+ */
+ public List remoteRepositories;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ public ArtifactFactory artifactFactory;
+ private MojoMonitor monitor;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ Log log = getLog();
+ if (!testScdl.exists()) {
+ log.info("No itest SCDL found, skipping integration tests");
+ return;
+ }
+
+ log.info("Starting Tuscany...");
+ ClassLoader cl = createHostClassLoader(getClass().getClassLoader(), extensions);
+ MavenEmbeddedRuntime runtime = createRuntime(cl);
+ MavenMonitorFactory monitorFactory = new MavenMonitorFactory(log);
+ runtime.setMonitorFactory(monitorFactory);
+ monitor = monitorFactory.getMonitor(MojoMonitor.class);
+ try {
+ runtime.initialize();
+ } catch (InitializationException e) {
+ throw new MojoExecutionException("Error initializing Tuscany runtime", e);
+ }
+ try {
+ SurefireTestSuite testSuite;
+ log.info("Deploying test SCDL from " + testScdl);
+ try {
+ // fixme this should probably be an isolated classloader
+ ClassLoader testClassLoader = createTestClassLoader(getClass().getClassLoader());
+
+ URI domain = URI.create(testDomain);
+ String harnessComponentName = testComponentName;
+ URI componentName = domain.resolve(harnessComponentName);
+ URI base = domain.resolve(harnessComponentName + "/");
+
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(testScdl.toURI().toURL());
+ impl.setClassLoader(testClassLoader);
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(componentName, impl);
+ Collection<Component> testComponent = runtime.deployTestScdl(definition);
+ testSuite = createTestSuite(runtime, definition, base);
+ for (Component component : testComponent) {
+ component.start();
+ }
+
+ runtime.startContext(componentName);
+ } catch (Exception e) {
+ monitor.runError(e);
+ throw new MojoExecutionException("Error deploying test component " + testScdl, e);
+ }
+ log.info("Executing tests...");
+
+ boolean success = runSurefire(testSuite);
+ if (!success) {
+ String msg = "There were test failures";
+ throw new MojoFailureException(msg);
+ }
+ } finally {
+ log.info("Stopping Tuscany...");
+ try {
+ runtime.destroy();
+ } catch (TuscanyRuntimeException e) {
+ monitor.runError(e);
+ }
+ }
+ }
+
+ protected ClassLoader createHostClassLoader(ClassLoader parent, Dependency[] extensions)
+ throws MojoExecutionException {
+ if (extensions == null || extensions.length == 0) {
+ return parent;
+ }
+
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ for (Dependency extension : extensions) {
+ Artifact artifact = extension.getArtifact(artifactFactory);
+ try {
+ resolver.resolve(artifact, remoteRepositories, localRepository);
+ ResolutionGroup resolutionGroup = metadataSource.retrieve(artifact,
+ localRepository,
+ remoteRepositories);
+ ArtifactResolutionResult result = resolver.resolveTransitively(resolutionGroup.getArtifacts(),
+ artifact,
+ remoteRepositories,
+ localRepository,
+ metadataSource);
+ artifacts.add(artifact);
+ artifacts.addAll(result.getArtifacts());
+ } catch (ArtifactResolutionException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } catch (ArtifactNotFoundException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } catch (ArtifactMetadataRetrievalException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+ URL[] urls = new URL[artifacts.size()];
+ int i = 0;
+ for (Artifact artifact : artifacts) {
+ File file = artifact.getFile();
+ assert file != null;
+ try {
+ urls[i++] = file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have made this valid
+ throw new AssertionError();
+ }
+ }
+
+ Log log = getLog();
+ if (log.isDebugEnabled()) {
+ log.debug("Tuscany extension classpath:");
+ for (URL url : urls) {
+ log.debug(" " + url);
+ }
+ }
+
+ return new CompositeClassLoader(null, urls, parent);
+ }
+
+ public boolean runSurefire(SurefireTestSuite testSuite) throws MojoExecutionException {
+ try {
+ Properties status = new Properties();
+ boolean success = run(testSuite, status);
+ getLog().debug("Test results: "+status);
+ return success;
+ } catch (ReporterException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } catch (TestSetFailedException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ public boolean run(SurefireTestSuite suite, Properties status) throws ReporterException, TestSetFailedException {
+ int totalTests = suite.getNumTests();
+
+ List<Reporter> reports = new ArrayList<Reporter>();
+ reports.add(new BriefFileReporter(reportsDirectory, trimStackTrace));
+ reports.add(new BriefConsoleReporter(trimStackTrace));
+ ReporterManager reporterManager = new ReporterManager(reports);
+ reporterManager.initResultsFromProperties(status);
+
+ reporterManager.runStarting(totalTests);
+
+ if (totalTests == 0) {
+ reporterManager.writeMessage("There are no tests to run.");
+ } else {
+ suite.execute(reporterManager, null);
+ }
+
+ reporterManager.runCompleted();
+ reporterManager.updateResultsProperties(status);
+ return reporterManager.getNumErrors() == 0 && reporterManager.getNumFailures() == 0;
+ }
+
+ protected MavenEmbeddedRuntime createRuntime(ClassLoader hostClassLoader) throws MojoExecutionException {
+ if (systemScdl == null) {
+ systemScdl = hostClassLoader.getResource("META-INF/tuscany/embeddedMaven.scdl");
+ }
+
+ MavenRuntimeInfo runtimeInfo = new MavenRuntimeInfo();
+ MavenEmbeddedArtifactRepository artifactRepository = new MavenEmbeddedArtifactRepository(artifactFactory,
+ resolver,
+ metadataSource,
+ localRepository,
+ remoteRepositories);
+ MavenEmbeddedRuntime runtime = new MavenEmbeddedRuntime(getLog());
+ runtime.setRuntimeInfo(runtimeInfo);
+ runtime.setSystemScdl(systemScdl);
+ runtime.setHostClassLoader(hostClassLoader);
+ runtime.setArtifactRepository(artifactRepository);
+ return runtime;
+ }
+
+ public ClassLoader createTestClassLoader(ClassLoader parent) {
+ URL[] urls = new URL[testClassPath.size()];
+ int idx = 0;
+ for (String s : testClassPath) {
+ File pathElement = new File(s);
+ try {
+ URL url = pathElement.toURI().toURL();
+ getLog().debug("Adding application URL: " + url);
+ urls[idx++] = url;
+ } catch (MalformedURLException e) {
+ // toURI should have encoded the URL
+ throw new AssertionError();
+ }
+
+ }
+ return new URLClassLoader(urls, parent);
+ }
+
+ protected SurefireTestSuite createTestSuite(MavenEmbeddedRuntime runtime,
+ ComponentDefinition<CompositeImplementation> definition,
+ URI uriBase) throws MojoExecutionException {
+ SCATestSuite suite = new SCATestSuite();
+
+ URI contextId = definition.getUri();
+ CompositeImplementation impl = definition.getImplementation();
+ CompositeComponentType<?,?,?> componentType = impl.getComponentType();
+ Map<String, ComponentDefinition<? extends Implementation<?>>> components = componentType.getComponents();
+ for (Map.Entry<String, ComponentDefinition<? extends Implementation<?>>> entry : components.entrySet()) {
+ String name = entry.getKey();
+ ComponentDefinition<? extends Implementation<?>> junitDefinition = entry.getValue();
+ Implementation<?> implementation = junitDefinition.getImplementation();
+ if (ImplementationJUnit.class.isAssignableFrom(implementation.getClass())) {
+ URI uri = uriBase.resolve(name);
+ SCATestSet testSet = createTestSet(runtime, name, contextId, uri, junitDefinition);
+ suite.add(testSet);
+ }
+ }
+ return suite;
+ }
+
+ protected SCATestSet createTestSet(MavenEmbeddedRuntime runtime,
+ String name,
+ URI contextId,
+ URI uri,
+ ComponentDefinition definition) throws MojoExecutionException {
+ ImplementationJUnit impl = (ImplementationJUnit) definition.getImplementation();
+ PojoComponentType componentType = impl.getComponentType();
+ Map services = componentType.getServices();
+ JavaMappedService testService = (JavaMappedService) services.get("testService");
+ if (testService == null) {
+ throw new MojoExecutionException("No testService defined on component: " + definition.getUri());
+ }
+ Map<String, ? extends Operation<?>> operations = testService.getServiceContract().getOperations();
+ return new SCATestSet(runtime, name, contextId, uri, operations.values());
+ }
+
+ public interface MojoMonitor {
+ @LogLevel("SEVERE")
+ void runError(Exception e);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnit.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnit.java
new file mode 100644
index 0000000000..592cd91a76
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnit.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest.implementation.junit;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationJUnit extends AtomicImplementation<PojoComponentType> {
+ private String className;
+
+ /**
+ * Constructor supplying the name of the JUnit test class
+ *
+ * @param className the name of the JUnit test class
+ */
+ public ImplementationJUnit(String className) {
+ this.className = className;
+ }
+
+ /**
+ * Returns the name of the JUnit test class.
+ *
+ * @return the name of the JUnit test class
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Sets the name of the JUnit test class.
+ *
+ * @param className the name of the JUnit test class
+ */
+ public void setClassName(String className) {
+ this.className = className;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnitLoader.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnitLoader.java
new file mode 100644
index 0000000000..e2daa7a3ec
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/ImplementationJUnitLoader.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest.implementation.junit;
+
+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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationJUnitLoader extends LoaderExtension<ImplementationJUnit> {
+ private static final QName JUNIT = new QName("http://tuscany.apache.org/xmlns/sca/2.0-alpha", "junit");
+
+ public ImplementationJUnitLoader(@Reference LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return JUNIT;
+ }
+
+ public ImplementationJUnit load(
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ String className = reader.getAttributeValue(null, "class");
+ return new ImplementationJUnit(className);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentBuilder.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentBuilder.java
new file mode 100644
index 0000000000..7407ed1150
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentBuilder.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest.implementation.junit;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.Parameter;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+
+/**
+ * Builds a Java-based atomic context from a component definition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JUnitComponentBuilder extends ComponentBuilderExtension<ImplementationJUnit> {
+
+ private ResourceHost host;
+
+ @Reference
+ public void setHost(ResourceHost host) {
+ this.host = host;
+ }
+
+ @SuppressWarnings("unchecked")
+ public AtomicComponent build(ComponentDefinition<ImplementationJUnit> definition, DeploymentContext deployment)
+ throws BuilderConfigException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ definition.getImplementation().getComponentType();
+ Class<?> implClass = componentType.getImplClass();
+
+ PojoConfiguration configuration = new PojoConfiguration();
+ if (definition.getInitLevel() != null) {
+ configuration.setInitLevel(definition.getInitLevel());
+ } else {
+ configuration.setInitLevel(componentType.getInitLevel());
+ }
+ if (componentType.getMaxAge() > 0) {
+ configuration.setMaxAge(componentType.getMaxAge());
+ } else if (componentType.getMaxIdleTime() > 0) {
+ configuration.setMaxIdleTime(componentType.getMaxIdleTime());
+ }
+ Method initMethod = componentType.getInitMethod();
+ if (initMethod != null) {
+ configuration.setInitInvoker(new MethodEventInvoker(initMethod));
+ }
+ Method destroyMethod = componentType.getDestroyMethod();
+ if (destroyMethod != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker(destroyMethod));
+ }
+
+ configuration.setProxyService(proxyService);
+ configuration.setWorkContext(workContext);
+ configuration.setImplementationClass(implClass);
+ configuration.setGroupId(deployment.getGroupId());
+
+ // setup property injection sites
+ for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
+ configuration.addPropertySite(property.getName(), property.getMember());
+ }
+
+ // setup reference injection sites
+ for (JavaMappedReference reference : componentType.getReferences().values()) {
+ Member member = reference.getMember();
+ if (member != null) {
+ // could be null if the reference is mapped to a constructor
+ configuration.addReferenceSite(reference.getUri().getFragment(), member);
+ }
+ }
+
+ for (Resource resource : componentType.getResources().values()) {
+ Member member = resource.getMember();
+ if (member != null) {
+ // could be null if the resource is mapped to a constructor
+ configuration.addResourceSite(resource.getName(), member);
+ }
+ }
+
+ // setup constructor injection
+ ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
+ Constructor<?> constr = ctorDef.getConstructor();
+ PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
+ configuration.setInstanceFactory(instanceFactory);
+ configuration.setConstructor(ctorDef);
+ configuration.setName(definition.getUri());
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+
+ // handle properties
+ handleProperties(definition, component);
+
+ // handle resources
+ handleResources(componentType, component);
+
+ handleCallbackSites(componentType, configuration);
+
+ if (componentType.getConversationIDMember() != null) {
+ component.addConversationIDFactory(componentType.getConversationIDMember());
+ }
+
+ return component;
+ }
+
+ private void handleCallbackSites(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ PojoConfiguration configuration) {
+ for (JavaMappedService service : componentType.getServices().values()) {
+ // setup callback injection sites
+ if (service.getCallbackReferenceName() != null) {
+ // Only if there is a callback reference in the service
+ configuration.addCallbackSite(service.getCallbackReferenceName(), service.getCallbackMember());
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void handleResources(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ JavaAtomicComponent component) {
+
+ for (Resource resource : componentType.getResources().values()) {
+ ObjectFactory<?> objectFactory = resource.getObjectFactory();
+ if (objectFactory != null) {
+ component.addResourceFactory(resource.getName(), objectFactory);
+ } else {
+ String name = resource.getName();
+ boolean optional = resource.isOptional();
+ Class<Object> type = (Class<Object>) resource.getType();
+ ResourceObjectFactory<Object> factory;
+ String mappedName = resource.getMappedName();
+ if (mappedName == null) {
+ // by type
+ factory = new ResourceObjectFactory<Object>(type, optional, host);
+ } else {
+ factory = new ResourceObjectFactory<Object>(type, mappedName, optional, host);
+ }
+ component.addResourceFactory(name, factory);
+ }
+ }
+ }
+
+ private void handleProperties(ComponentDefinition<ImplementationJUnit> definition, JavaAtomicComponent component) {
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ }
+
+ protected Class<ImplementationJUnit> getImplementationType() {
+ return ImplementationJUnit.class;
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentTypeLoader.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentTypeLoader.java
new file mode 100644
index 0000000000..bb7ff476a2
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitComponentTypeLoader.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest.implementation.junit;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JUnitComponentTypeLoader extends ComponentTypeLoaderExtension<ImplementationJUnit> {
+ private static final URI TEST_SERVICE_NAME = URI.create("#testService");
+ private Introspector introspector;
+
+ @Constructor
+ public JUnitComponentTypeLoader(@Reference LoaderRegistry loaderRegistry,
+ @Reference IntrospectionRegistry introspector) {
+ super(loaderRegistry);
+ this.introspector = introspector;
+ }
+
+ @Override
+ protected Class<ImplementationJUnit> getImplementationClass() {
+ return ImplementationJUnit.class;
+ }
+
+ public void load(ImplementationJUnit implementation, DeploymentContext context) throws LoaderException {
+ String className = implementation.getClassName();
+ Class<?> implClass;
+ try {
+ implClass = context.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException(className, e);
+ }
+ PojoComponentType componentType = loadByIntrospection(implementation, context, implClass);
+ implementation.setComponentType(componentType);
+ }
+
+ protected PojoComponentType loadByIntrospection(ImplementationJUnit implementation,
+ DeploymentContext deploymentContext,
+ Class<?> implClass) throws ProcessingException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>(implClass);
+ introspector.introspect(implClass, componentType, deploymentContext);
+
+ if (componentType.getInitMethod() == null) {
+ componentType.setInitMethod(getCallback(implClass, "setUp"));
+ }
+ if (componentType.getDestroyMethod() == null) {
+ componentType.setDestroyMethod(getCallback(implClass, "tearDown"));
+ }
+ ServiceContract testContract = generateTestContract(implClass);
+ JavaMappedService testService = new JavaMappedService(TEST_SERVICE_NAME, testContract, false);
+ componentType.add(testService);
+ return componentType;
+ }
+
+ protected Method getCallback(Class<?> implClass, String name) {
+ while (Object.class != implClass) {
+ try {
+ Method callback = implClass.getDeclaredMethod(name);
+ callback.setAccessible(true);
+ return callback;
+ } catch (NoSuchMethodException e) {
+ implClass = implClass.getSuperclass();
+ continue;
+ }
+ }
+ return null;
+ }
+
+ private static final DataType<List<DataType<Type>>> INPUT_TYPE;
+ private static final DataType<Type> OUTPUT_TYPE;
+ private static final List<DataType<Type>> FAULT_TYPE;
+
+ static {
+ List<DataType<Type>> paramDataTypes = Collections.emptyList();
+ INPUT_TYPE = new DataType<List<DataType<Type>>>("idl:input", Object[].class, paramDataTypes);
+ OUTPUT_TYPE = new DataType<Type>(null, void.class, void.class);
+ FAULT_TYPE = Collections.emptyList();
+ }
+
+ protected ServiceContract generateTestContract(Class<?> implClass) {
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ for (Method method : implClass.getMethods()) {
+ // see if this is a test method
+ if (Modifier.isStatic(method.getModifiers())) {
+ continue;
+ }
+ if (method.getReturnType() != void.class) {
+ continue;
+ }
+ if (method.getParameterTypes().length != 0) {
+ continue;
+ }
+ String name = method.getName();
+ if (name.length() < 5 || !name.startsWith("test")) {
+ continue;
+ }
+ Operation<Type> operation = new Operation<Type>(name, INPUT_TYPE, OUTPUT_TYPE, FAULT_TYPE);
+ operations.put(name, operation);
+ }
+ return new JUnitServiceContract(operations);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitServiceContract.java b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitServiceContract.java
new file mode 100644
index 0000000000..4e3fad0db2
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/implementation/junit/JUnitServiceContract.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.itest.implementation.junit;
+
+import java.util.Map;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JUnitServiceContract extends ServiceContract<Type> {
+
+ public JUnitServiceContract(Map<String, Operation<Type>> operations) {
+ setOperations(operations);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/main/resources/META-INF/tuscany/embeddedMaven.scdl b/sandbox/old/contrib/runtime-itest/plugin/src/main/resources/META-INF/tuscany/embeddedMaven.scdl
new file mode 100644
index 0000000000..493952944c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/main/resources/META-INF/tuscany/embeddedMaven.scdl
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.sca.plugins.itest.EmbeddedMaven"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="interceptorBuilderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.interceptor.InterceptorBuilderRegistryImpl"/>
+ </component>
+
+ <component name="wireAttacherRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.physical.WireAttacherRegistryImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include composite implementation type -->
+ <include name="org.apache.tuscany.core.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- include exception formatters -->
+ <include name="org.apache.tuscany.core.Formatters" scdlResource="org/apache/tuscany/core/formatters.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation"
+ scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation"
+ scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="org.apache.tuscany.sca.plugin.itest.implementation.junit.ImplementationJUnitLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.sca.plugin.itest.implementation.junit.ImplementationJUnitLoader"/>
+ </component>
+
+ <component name="org.apache.tuscany.sca.plugin.itest.implementation.junit.JUnitComponentTypeLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.sca.plugin.itest.implementation.junit.JUnitComponentTypeLoader"/>
+ </component>
+
+ <component name="org.apache.tuscany.sca.plugin.itest.implementation.junit.JUnitComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.sca.plugin.itest.implementation.junit.JUnitComponentBuilder"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/site/apt/usage.apt b/sandbox/old/contrib/runtime-itest/plugin/src/site/apt/usage.apt
new file mode 100644
index 0000000000..7606bd23a1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/site/apt/usage.apt
@@ -0,0 +1,158 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+Usage
+
+ The <<<tuscany-itest-plugin>>> is associated with the <<<integration-test>>> phase of the build lifecycle.
+
+ The plugin can be invoked directly from the command line:
+
++---+
+mvn org.apache.tuscany.sca:tuscany-itest-plugin:test
++---+
+
+ or can be included in the build definition for your project:
+
++---+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
++---+
+
+* Writing Integration Tests
+
+ Integration tests are written as JUnit TestCases (currently only JUnit 3.8.1 is supported but other frameworks
+ may be added later) that use SCA references to access services provided by the components under test. The
+ references are injected into your testcase before its setUp method is called (using constructor, setter or field
+ injection).
+
+ For example, to test a component that implemented the <<<MyService>>> interface you could write:
+
++---+
+public class ServiceTestComponent extends TestCase {
+
+ @Reference
+ public MyService service;
+
+ public void testSomething() {
+ assertEquals(result, service.doSomething);
+ }
+}
++---+
+
+ This TestCase is used as a component within a SCA composite that defines the test suite
+ as described in the next section. This separates TestCase's for normal unit tests from
+ those that are integration tests.
+
+ If any methods have an SCA <<<@Init>>> or <<<@Destroy>>> annotation they will be called
+ before and after executing tests; if no methods are annotated in this way the normal
+ JUnit <<<setUp>>> and <<<tearDown>>> methods will be called.
+
+ If the component's scope is <<<STATELESS>>> (the default), then a new instance of the
+ test component will used to run each test; if the component's scope is <<<COMPOSITE>>>
+ then a single instance will be used to run all tests. The scope can be set with the
+ standard SCA <<<@Scope>>> annotation.
+
+* Defining an SCA Test Suite
+
+ The Test Suite for your integration tests is defined by an SCA composite file that contains
+ the test components written above wired to the production components for the application.
+ The test components must use an implementation type of <<< <tuscany:junit> >>>.
+
+ A simple way to achieve this is to use a SCDL <include> element to include the content of
+ production composite in the test harness; this gives the test components access to all of
+ the components and references in the production composite.
+
+ For example, the following SCDL configures the <<<ServiceTestComponent>>> above
+ to test the <<<MyServiceComponent>>> in the production composite <<<ProductionComposite>>>:
+
++---+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="PropertyTestHarnessComposite">
+
+ <include name="ProductionComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testMyService">
+ <tuscany:junit class="ServiceTestComponent"/>
+ <reference name="service">MyServiceImpl</reference>
+ </component>
+</composite>
++---+
+
+ Alternatively, the production composite can be tested as a black box by using it to
+ implement a component and wiring test components to it. This allows the externally
+ visible services to be tested without knowledge of the internals of the composite.
+
+ For example, the following SCDL tests the <<<ProductionComposite>>> in this way:
+
++---+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="PropertyTestHarnessComposite">
+
+ <component name="ProductionComponent">
+ <implementation.composite name="ProductionComposite"
+ scdlResource="META-INF/sca/default.scdl"/>
+ </component>
+
+ <component name="testMyService">
+ <tuscany:junit class="ServiceTestComponent"/>
+ <reference name="service">ProductionComponent</reference>
+ </component>
+</composite>
++---+
+
+ The location of this test composite definition can be specified using the <<<testScdl>>>
+ plugin configuration property; the default location is <<<${project.build.testOutputDirectory}/itest.scdl>>>
+ which allows the <<<itest.scdl>>> source file to be placed in the test resources (<<<src/test/resources>>>).
+
+* Test Result Output
+
+ The test results are output using Surefire's reporting framework for integration with other test reports.
+ XML and test results are stored in the normal test output directory (<<<target/surefire-reports>>>) with
+ a summary displayed on the console:
+
++---+
+[INFO] [tuscany-itest:test {execution: default}]
+[INFO] Starting Tuscany...
+[INFO] Deploying test SCDL from .../target/test-classes/itest.scdl
+[INFO] Executing tests...
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running testMyService
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
+
+Results :
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+[INFO] Stopping Tuscany...
++---+ \ No newline at end of file
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/site/fml/faq.fml b/sandbox/old/contrib/runtime-itest/plugin/src/site/fml/faq.fml
new file mode 100644
index 0000000000..681567e432
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/site/fml/faq.fml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<faqs id="FAQ" title="Frequently Asked Questions">
+ <part id="General">
+ <faq id="junit4-support">
+ <question>Does the plugin support JUnit 4.0?</question>
+ <answer>
+ <p>
+ Not at this time.
+ </p>
+ </answer>
+ </faq>
+ <faq id="extensions">
+ <question>How do I add extensions to the runtime?</question>
+ <answer>
+ <p>
+ The plugin uses the normal extension mechanisms provided by
+ the Apache Tuscany runtime.
+ </p>
+ <p>
+ At the moment this requires supplying a custom system SCDL file that
+ includes the extension composites. In the future, we plan to load
+ extensions dynamically - please check back later.
+ </p>
+ </answer>
+ </faq>
+ <faq id="service-support">
+ <question>Can I use services provided by another systems?</question>
+ <answer>
+ <p>
+ You can define &lt;reference&gt; elements in your composite to access
+ services using a binding. Those can be standard web services, or any
+ other type of service that there is a binding for.
+ </p>
+ </answer>
+ </faq>
+ <faq id="domain-support">
+ <question>Can I use services provided by another SCA domain?</question>
+ <answer>
+ <p>
+ As we add federation support, the local runtime will be able to
+ join any SCA domain (subject to authorization) and use its services.
+ </p>
+ </answer>
+ </faq>
+ </part>
+</faqs>
diff --git a/sandbox/old/contrib/runtime-itest/plugin/src/site/site.xml b/sandbox/old/contrib/runtime-itest/plugin/src/site/site.xml
new file mode 100644
index 0000000000..bf5bf8c35b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/plugin/src/site/site.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ </menu>
+ <menu name="Examples">
+ </menu>
+ </body>
+</project>
diff --git a/sandbox/old/contrib/runtime-itest/pom.xml.off b/sandbox/old/contrib/runtime-itest/pom.xml.off
new file mode 100644
index 0000000000..2907a12f73
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/pom.xml.off
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>runtime</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>itest</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Integration Test Runtime</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>plugin</module>
+ <module>smoketest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <!-- for the release profile exclude the smoketest -->
+ <id>release</id>
+ <modules>
+ <module>plugin</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/LICENSE.txt b/sandbox/old/contrib/runtime-itest/smoketest/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/runtime-itest/smoketest/NOTICE.txt b/sandbox/old/contrib/runtime-itest/smoketest/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-itest/smoketest/pom.xml.off b/sandbox/old/contrib/runtime-itest/smoketest/pom.xml.off
new file mode 100644
index 0000000000..d6a2023c91
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/pom.xml.off
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>itest</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.itest</groupId>
+ <artifactId>itest-smoketest</artifactId>
+ <name>Apache Tuscany Integration Test Smoketest</name>
+ <description>Smoketest for the ITest plugin</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java b/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
new file mode 100644
index 0000000000..34c7a1ec12
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting();
+}
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..f269dc09c1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/src/main/java/org/apache/tuscany/sca/runtime/itest/smoketest/HelloServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/runtime-itest/smoketest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..bc000a9365
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ITestSmoketestComposite">
+
+ <component name="Hello">
+ <implementation.java class="org.apache.tuscany.sca.runtime.itest.smoketest.HelloServiceImpl"/>
+ <property name="greeting">Hello World</property>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java b/sandbox/old/contrib/runtime-itest/smoketest/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
new file mode 100644
index 0000000000..895989330b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/src/test/java/org/apache/tuscany/sca/runtime/itest/smoketest/BasicTestComponent.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.itest.smoketest;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicTestComponent extends TestCase {
+ @Reference
+ public HelloService hello;
+
+ public void testGreeting() {
+ assertEquals("Hello World", hello.getGreeting());
+ }
+}
diff --git a/sandbox/old/contrib/runtime-itest/smoketest/src/test/resources/itest.scdl b/sandbox/old/contrib/runtime-itest/smoketest/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..2cfa767a34
--- /dev/null
+++ b/sandbox/old/contrib/runtime-itest/smoketest/src/test/resources/itest.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="TestHarnessComposite">
+
+ <include name="ITestSmoketestComposite" scdlResource="META-INF/sca/default.scdl"/>
+
+ <component name="testComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.runtime.itest.smoketest.BasicTestComponent"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/assembly/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt
new file mode 100644
index 0000000000..b18217bd7a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt
@@ -0,0 +1,163 @@
+${project.name}
+Copyright (c) 2005 - 2007 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/).
+
+----- NOTICE from LICENSE.txt file for classworlds project --------------------
+* profiles/launcher/boot/classworlds-1.1.jar
+-------------------------------------------------------------------------------
+
+/*
+ $Id$
+
+ Copyright 2002 (C) The Codehaus. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "classworlds" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission, please
+ contact bob@codehaus.org.
+
+ 4. Products derived from this Software may not be called "classworlds"
+ nor may "classworlds" appear in their names without prior written
+ permission of The Codehaus. "classworlds" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus.
+ (http://classworlds.codehaus.org/).
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+----- NOTICE from LICENSE.txt file in jsch-0.1.24 distribution ----------------
+* profiles/launcher/boot/jsch-0.1.24.jar
+-------------------------------------------------------------------------------
+
+JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2002,2003,2004,2005 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----- NOTICE from Codehaus for Plexus Project ---------------------------------
+* profiles/launcher/boot/plexus-container-default-1.0-alpha-9.jar
+* profiles/launcher/boot/plexus-interactivity-api-1.0-alpha-4.jar
+* profiles/launcher/boot/plexus-utils-1.1.jar
+-------------------------------------------------------------------------------
+
+ The MIT License
+
+ Copyright (c) 2004, The Codehaus
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+-----
+
+Some portions of Plexus are also distributed under other BSD-style licenses
+including the Apache License Version 2.0
+
+----- NOTICE from StAX project at http://svn.codehaus.org/stax/trunk/dev/README-API.txt
+* profiles/launcher/boot/stax-api-1.0.1.jar
+-------------------------------------------------------------------------------
+
+These files together comprise the API for JSR 173 (Streaming API for XML Specification), including its API classes and interfaces.
+
+
+The following lists the files in this distribution:
+
+README-API.txt [README file for JSR 173 api bundle.]
+ASF2.0.txt [Apache Software Foundation License 2.0.]
+jsr173_1.0_api.jar [The API classes and interfaces in binary format.]
+jsr173_1.0_src.jar [The API classes and interfaces in source format.]
+
+Your right to use the listed files, whether together or individually, is governed by the Apache Software Foundation License 2.0 included in this bundle.
+
+Please see the javadoc for information on how to get started.
+
+----- NOTICE from wstx-asl-3.2.0.jar ------------------------------------------
+* profiles/launcher/boot/wstx-asl-3.2.0.jar
+-------------------------------------------------------------------------------
+
+This product currently only contains code developed by authors
+of specific components, as identified by the source code files.
+
+Since product implements StAX API, it has dependencies to StAX API
+classes.
+
+For additional credits (generally to people who reported problems)
+see CREDITS file.
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off b/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off
new file mode 100644
index 0000000000..0e5e3af64d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>assembly</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Standalone Assembly</name>
+ <description>Module to smoketest the standalone runtime.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>launcher</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>standalone.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt
new file mode 100644
index 0000000000..40d0b7242f
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt
@@ -0,0 +1,18 @@
+Apache Tuscany Standalone Runtime Distribution
+----------------------------------------------
+
+This distribution provides support for running SCA composites in a
+standalone client environment using a client launcher. To launch
+a composite run:
+
+ $ java -jar bin/launcher.jar <yourComposite> [args ...]
+
+The configuration for the runtime environment used by the launcher is
+defined in the profiles/launcher directory.
+
+Detailed documentation on developing applications using SCA and running
+them on Apache Tuscany can be found on the project website at:
+ http://incubator.apache.org/tuscany/
+
+Alternatively questions can be sent to the mailing list at:
+ mailto:tuscany-user@ws.apache.org
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl
new file mode 100644
index 0000000000..66b3af958c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.composite">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeContainer"/>
+ </component>
+
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- Include discovery -->
+ <include name="org.apache.tuscany.service.discovery" scdlResource="org/apache/tuscany/service/discovery/discovery.jxta.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">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/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl
new file mode 100644
index 0000000000..852d10a709
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">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/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <component name="launchedLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedLoader"/>
+ </component>
+
+ <component name="launchedComponentLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentTypeLoader"/>
+ </component>
+
+ <component name="launchedComponentBuilder">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentBuilder"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="loaderExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="incompatibleServiceContractExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml b/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml
new file mode 100644
index 0000000000..87745b7021
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <files>
+ <!-- include legal and other files -->
+ <file>
+ <source>LICENSE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ <file>
+ <source>NOTICE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ </file>
+ </files>
+
+ <fileSets>
+ <!-- include assembly files -->
+ <fileSet>
+ <directory>src/main/assembly</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <!-- copy executable commands to the bin directory without version info -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:launcher</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-api</exclude>
+ </excludes>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <fileMode>755</fileMode>
+ </dependencySet>
+
+ <!-- copy dependencies used by the executable commands to the lib directory -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-api</include>
+ <include>org.osoa:sca-api-r1.0</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ </includes>
+ <outputDirectory>lib</outputDirectory>
+ <outputFileNameMapping>${artifactId}-${baseVersion}.${extension}</outputFileNameMapping>
+ </dependencySet>
+
+ <!-- copy boot dependencies to launcher profile -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ </excludes>
+ <outputDirectory>profiles/launcher/boot</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/.ruleset b/sandbox/old/contrib/runtime-standalone/launcher/.ruleset
new file mode 100644
index 0000000000..f27a8fe562
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/launcher/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-standalone/launcher/pom.xml.off b/sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off
new file mode 100644
index 0000000000..50db868b9d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>launcher</artifactId>
+ <name>Apache Tuscany SCA Application Launcher</name>
+ <description>Standalone executable jar that can be used to launch a SCA application.</description>
+
+ <!--
+ This library will typically be added to the application's classpath and so should
+ should have as few dependencies as possible and nothing from the Tuscany runtime.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.launcher.Main</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java b/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
new file mode 100644
index 0000000000..e011c5a3a5
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.launcher;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+import org.apache.tuscany.runtime.standalone.DirectoryHelper;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+
+/**
+ * Main class for launcher runtime environment. <code>
+ * usage: java [jvm-options] -jar launcher.jar <componentURI>
+ * </code>
+ * where the componentURI identifies a component in the assembly that should be
+ * called.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Main {
+
+ /**
+ * Main method.
+ *
+ * @param args the command line args
+ * @throws Throwable if there are problems launching the runtime or
+ * application
+ */
+ public static void main(String[] args) throws Throwable {
+
+ if (args.length < 1) {
+ usage();
+ throw new AssertionError();
+ }
+
+ File applicationFile = new File(args[0]);
+ if (!applicationFile.exists()) {
+ System.err.println(getMessage("org.apache.tuscany.launcher.NoComposite", applicationFile));
+ System.exit(2);
+ }
+
+ String[] appArgs = new String[0];
+ if(args.length > 1) {
+ appArgs = new String[args.length - 1];
+ System.arraycopy(args, 1, appArgs, 0, appArgs.length);
+ }
+
+ StandaloneRuntimeInfo runtimeInfo = DirectoryHelper.createRuntimeInfo("launcher", Main.class);
+ StandaloneRuntime runtime = (StandaloneRuntime)DirectoryHelper.createRuntime(runtimeInfo);
+
+ URL applicationJar = applicationFile.toURL();
+ ClassLoader applicationClassLoader =
+ new URLClassLoader(new URL[] {applicationJar}, runtime.getHostClassLoader());
+ String applicationScdl = System.getProperty("launcher.scdl", "META-INF/sca/default.scdl");
+ URL applicationScdlURL = applicationClassLoader.getResource(applicationScdl);
+ if (applicationScdlURL == null) {
+ System.err.println(getMessage("org.apache.tuscany.launcher.NoApplicationSCDL", applicationScdl));
+ System.exit(2);
+ }
+
+ // boot the runtime
+ runtime.initialize();
+
+ int status = runtime.deployAndRun(applicationScdlURL, applicationClassLoader, appArgs);
+ System.exit(status);
+ }
+
+ private static void usage() {
+ System.err.println(getMessage("org.apache.tuscany.launcher.Usage"));
+ System.exit(1);
+ }
+
+ private static String getMessage(String id, Object... params) {
+ ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
+ String message = bundle.getString(id);
+ return MessageFormat.format(message, params);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties b/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
new file mode 100644
index 0000000000..51cdb7087a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev$ $Date$
+#
+org.apache.tuscany.launcher.Usage=usage: java [jvm-options] -jar launcher.jar <componentJar> [apparg1, apparg2, ...]
+org.apache.tuscany.launcher.NoComponent=No component found with id "{0}"
+org.apache.tuscany.launcher.NoComposite=No composite archive found: {0}
+org.apache.tuscany.launcher.NoApplicationSCDL=No application SCDL found: {0}
diff --git a/sandbox/old/contrib/runtime-standalone/pom.xml.off b/sandbox/old/contrib/runtime-standalone/pom.xml.off
new file mode 100644
index 0000000000..1a38e942cc
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/pom.xml.off
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>runtime</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Standalone SCA Runtime</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>standalone-api</module>
+ <module>launcher</module>
+ <module>standalone-host</module>
+ <module>server.start</module>
+ <module>server.shutdown</module>
+ <module>assembly</module>
+ <module>smoketest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <!-- for the release profile exclude the smoketest -->
+ <id>release</id>
+ <modules>
+ <module>standalone-api</module>
+ <module>launcher</module>
+ <module>standalone-host</module>
+ <module>server.start</module>
+ <module>server.shutdown</module>
+ <module>assembly</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-standalone/server.shutdown/pom.xml.off b/sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off
new file mode 100644
index 0000000000..17eaeaceed
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>server.shutdown</artifactId>
+ <name>Apache Tuscany Standalone Server Shutdown</name>
+ <description>Standalone executable jar that can be used to shutdown the tuscany server.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.standalone.server.ShutdownServer</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java b/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java
new file mode 100644
index 0000000000..ada82c4bb3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+import java.io.IOException;
+
+import javax.management.JMException;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnector;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ShutdownServer {
+
+ /** Tuscany admin host. */
+ private static final String ADMIN_HOST_PROPERTY = "tuscany.adminHost";
+
+ /** Tuscany admin port. */
+ private static final String ADMIN_PORT_PROPERTY = "tuscany.adminPort";
+
+ /** Default host. */
+ private static final String DEFAULT_ADMIN_HOST = "localhost";
+
+ /** Default port. */
+ private static final int DEFAULT_ADMIN_PORT = 1099;
+
+ /** Host. */
+ private String host = DEFAULT_ADMIN_HOST;
+
+ /** Port. */
+ private int port = DEFAULT_ADMIN_PORT;
+
+ /**
+ *
+ * @param args Commandline arguments.
+ */
+ public static void main(String[] args) throws Exception {
+
+ ShutdownServer shutdownServer = new ShutdownServer();
+ shutdownServer.shutdown();
+
+ }
+
+ /**
+ * Initializes the host and the port.
+ *
+ */
+ private ShutdownServer() {
+
+ if(System.getProperty(ADMIN_HOST_PROPERTY) != null) {
+ host = System.getProperty(ADMIN_HOST_PROPERTY);
+ }
+
+ if(System.getProperty(ADMIN_PORT_PROPERTY) != null) {
+ port = Integer.parseInt(System.getProperty(ADMIN_PORT_PROPERTY));
+ }
+
+ }
+
+ /**
+ * Shuts down the server.
+ * @throws IOException
+ * @throws JMException
+ *
+ */
+ private void shutdown() throws IOException, JMException {
+
+ RMIConnector rmiConnector = null;
+
+ try {
+
+ JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/server");
+ rmiConnector = new RMIConnector(url, null);
+ rmiConnector.connect();
+
+ MBeanServerConnection con = rmiConnector.getMBeanServerConnection();
+ con.invoke(new ObjectName("tuscany:name=tuscanyServer"), "shutdown", null, null);
+
+ } finally {
+ if(rmiConnector != null) {
+ rmiConnector.close();
+ }
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/server.start/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-standalone/server.start/pom.xml.off b/sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off
new file mode 100644
index 0000000000..e9d8cbcdb1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>server.start</artifactId>
+ <name>Apache Tuscany Standalone Server Start</name>
+ <description>Standalone executable jar that can be used to start the tuscany server.</description>
+
+ <!--
+ This library will typically be added to the application's classpath and so should
+ should have as few dependencies as possible and nothing from the Tuscany runtime.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.services.management</groupId>
+ <artifactId>management-jmx</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.standalone.server.TuscanyServer</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
new file mode 100644
index 0000000000..de23beb613
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+import java.beans.Beans;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.management.MBeanServer;
+
+import org.apache.tuscany.host.management.ManagementService;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.runtime.ShutdownException;
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.runtime.standalone.DirectoryHelper;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfoImpl;
+import org.apache.tuscany.service.management.jmx.JmxManagementService;
+import org.apache.tuscany.service.management.jmx.agent.Agent;
+import org.apache.tuscany.service.management.jmx.agent.RmiAgent;
+
+/**
+ * This class provides the commandline interface for starting the
+ * tuscany standalone server.
+ * <p/>
+ * <p/>
+ * The class boots the tuscany server and also starts a JMX server
+ * and listens for shutdown command. The server itself is available
+ * by the object name <code>tuscany:type=server,name=tuscanyServer
+ * </code>. It also allows a runtime to be booted given a bootpath.
+ * The JMX domain in which the runtime is registered si definied in
+ * the file <code>$bootPath/etc/runtime.properties</code>. The properties
+ * defined are <code>jmx.domain</code> and <code>offline</code>.
+ * </p>
+ * <p/>
+ * <p/>
+ * The install directory can be specified using the system property
+ * <code>tuscany.installDir</code>. If not specified it is asumed to
+ * be the directory from where the JAR file containing the main class
+ * is loaded.
+ * </p>
+ * <p/>
+ * <p/>
+ * The administration port can be specified using the system property
+ * <code>tuscany.adminPort</tuscany>.If not specified the default port
+ * that is used is <code>1099</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyServer implements TuscanyServerMBean {
+
+ /**
+ * Agent
+ */
+ private final Agent agent;
+
+ /**
+ * Install directory
+ */
+ private final File installDirectory;
+
+ /**
+ * Started runtimes.
+ */
+ private final Map<String, TuscanyRuntime> bootedRuntimes = new ConcurrentHashMap<String, TuscanyRuntime>();
+
+ /**
+ * @param args Commandline arguments.
+ */
+ public static void main(String[] args) throws Exception {
+ TuscanyServer server = new TuscanyServer();
+ server.start();
+
+ // Start any runtimes specified in the cli
+ for(String profile : args) {
+ server.startRuntime(profile);
+ }
+ }
+
+ /**
+ * Constructor initializes all the required classloaders.
+ *
+ * @throws MalformedURLException
+ */
+ private TuscanyServer() throws MalformedURLException {
+ installDirectory = DirectoryHelper.getInstallDirectory(TuscanyServer.class);
+ agent = RmiAgent.getInstance();
+ }
+
+ /**
+ * Starts a runtime specified by the bootpath.
+ *
+ * @param profileName Profile for the runtime.
+ */
+ public final void startRuntime(final String profileName) {
+
+ try {
+
+ final File profileDirectory = DirectoryHelper.getProfileDirectory(installDirectory, profileName);
+ final File bootDirectory = DirectoryHelper.getBootDirectory(installDirectory, profileDirectory, null);
+
+ final MBeanServer mBeanServer = agent.getMBeanServer();
+ final StandaloneRuntimeInfo runtimeInfo = createRuntimeInfo(profileName);
+ final ManagementService<?> managementService = new JmxManagementService(mBeanServer, profileName);
+ final TuscanyRuntime<?> runtime = createRuntime(bootDirectory, runtimeInfo);
+ runtime.setManagementService(managementService);
+ runtime.initialize();
+
+ bootedRuntimes.put(profileName, runtime);
+
+ } catch (InitializationException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (ClassNotFoundException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (Throwable ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ }
+
+ System.err.println("Started");
+
+ }
+
+ /**
+ * @see org.apache.tuscany.standalone.server.TuscanyServerMBean#shutdownRuntime(java.lang.String)
+ */
+ public final void shutdownRuntime(String bootPath) {
+
+ try {
+ TuscanyRuntime runtime = bootedRuntimes.get(bootPath);
+ if (runtime != null) {
+ runtime.destroy();
+ bootedRuntimes.remove(runtime);
+ runtime = null;
+ }
+ } catch (ShutdownException ex) {
+ throw new TuscanyServerException(ex);
+ }
+
+ }
+
+ /**
+ * Starts the server.
+ */
+ public final void shutdown() {
+
+ for (String bootPath : bootedRuntimes.keySet()) {
+ shutdownRuntime(bootPath);
+ }
+ agent.shutdown();
+ System.err.println("Shutdown");
+ System.exit(0);
+
+ }
+
+ /**
+ * TODO Share this code with launcher.
+ *
+ * Creates the runtime info.
+ *
+ * @param profile profile for which runtime info is created.
+ * @return Runtime info.
+ * @throws IOException If unable to read the runtime properties.
+ * @throws URISyntaxException
+ */
+ private StandaloneRuntimeInfo createRuntimeInfo(String profile) throws IOException, URISyntaxException {
+
+ File profileDir = DirectoryHelper.getProfileDirectory(installDirectory, profile);
+
+ // load properties for this runtime
+ File propFile = new File(profileDir, "etc/runtime.properties");
+ Properties props = DirectoryHelper.loadProperties(propFile, System.getProperties());
+ String domain = props.getProperty("domain");
+
+ // online unless the offline property is set
+ boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+
+ return new StandaloneRuntimeInfoImpl(new URI(domain), profile, installDirectory, profileDir, null, online, props);
+ }
+
+ /**
+ * TODO Share this code with launcher.
+ *
+ * Creates the runtime.
+ *
+ * @param bootDirectory Boot directory for the runtime.
+ * @param runtimeInfo Runtime info.
+ * @return Runtime.
+ */
+ private TuscanyRuntime createRuntime(final File bootDirectory, final StandaloneRuntimeInfo runtimeInfo) throws IOException, ClassNotFoundException {
+
+ final URL profileUrl = runtimeInfo.getProfileDirectory().toURL();
+ final ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+ final ClassLoader bootClassLoader = DirectoryHelper.createClassLoader(hostClassLoader, bootDirectory);
+
+ final URL systemScdl = getSystemScdl(profileUrl, runtimeInfo);
+ if (systemScdl == null) {
+ throw new TuscanyServerException("Unable to find system scdl");
+ }
+
+ final String className =
+ runtimeInfo.getProperty("tuscany.launcherClass",
+ "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
+ final StandaloneRuntime runtime = (StandaloneRuntime) Beans.instantiate(bootClassLoader, className);
+ runtime.setSystemScdl(systemScdl);
+ runtime.setHostClassLoader(hostClassLoader);
+
+ runtime.setRuntimeInfo(runtimeInfo);
+ return runtime;
+
+ }
+
+ /**
+ * Gets the system SCDL.
+ *
+ * @param bootClassLoader Boot classloader.
+ * @return URL to the system SCDL.
+ * @throws MalformedURLException
+ */
+ private URL getSystemScdl(URL profileUrl, StandaloneRuntimeInfo runtimeInfo) throws MalformedURLException {
+ return new URL(profileUrl, runtimeInfo.getProperty("tuscany.systemSCDL", "system.scdl"));
+ }
+
+ /**
+ * Starts the server and starts the JMX agent.
+ */
+ private void start() {
+ agent.start();
+ agent.register(this, "tuscany:type=server,name=tuscanyServer");
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java
new file mode 100644
index 0000000000..97a81162ee
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception thrown by the tuscany server during startup and shutdown.
+ *
+ * @version $Revisiion$ $Date$
+ *
+ */
+
+@SuppressWarnings("serial")
+public class TuscanyServerException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the cause.
+ * @param cause Root cause of the exception.
+ */
+ public TuscanyServerException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Initializes the message.
+ * @param message Message of the exception.
+ */
+ public TuscanyServerException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java
new file mode 100644
index 0000000000..a3bc6291b2
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+/**
+ * Management interface for the tuscany server.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface TuscanyServerMBean {
+
+ /**
+ * Starts a runtime specified by the bootpath.
+ *
+ * @param profileName Profile for the runtime.
+ */
+ public void startRuntime(String profileName);
+
+ /**
+ * Shuts down a runtime specified by the bootpath.
+ *
+ * @param bootPath Bootpath for the runtime.
+ */
+ public void shutdownRuntime(String bootPath);
+
+ /**
+ * Starts the server.
+ *
+ */
+ public void shutdown();
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off b/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off
new file mode 100644
index 0000000000..5aec4763e3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>smoketest</artifactId>
+ <name>Apache Tuscany SCA Standalone Smoketest</name>
+ <description>Module to smoketest the standalone runtime.</description>
+
+ <properties>
+ <tuscany.installDir>${project.build.directory}/assembly</tuscany.installDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>smoketest</finalName>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>assembly</artifactId>
+ <version>${project.version}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${tuscany.installDir}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/SmokeTest*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java
new file mode 100644
index 0000000000..7d45d73183
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting();
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..a2d367096a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting") String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java
new file mode 100644
index 0000000000..271f9e8273
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Launched {
+ private HelloService hello;
+
+ @Reference
+ public void setHello(HelloService hello) {
+ this.hello = hello;
+ }
+
+ public int main(String[] args) throws Exception {
+ if (args.length == 0) {
+ System.out.println("No Args");
+ return 0;
+ }
+ String command = args[0];
+ if ("testReference".equals(command)) {
+ if ("Hello World".equals(hello.getGreeting())) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ return 1;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..ca2ac88a01
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="SmoketestComposite">
+
+ <component name="Main">
+ <tuscany:launched class="org.apache.tuscany.sca.runtime.standalone.smoketest.Launched"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+ <component name="Hello">
+ <implementation.java class="org.apache.tuscany.sca.runtime.standalone.smoketest.HelloServiceImpl"/>
+ <property name="greeting">Hello World</property>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
new file mode 100644
index 0000000000..64d5c02192
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.BufferedInputStream;
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class CommandTestCase extends TestCase {
+ protected File buildDir;
+ protected File installDir;
+
+ public void compareOutput(String master, InputStream is) throws Exception {
+ String processText = readStream(is);
+ assertEquals(master, processText);
+ }
+
+ public String loadResource(String resource) throws IOException {
+ InputStream is = getClass().getResourceAsStream(resource);
+ assertNotNull(is);
+ return readStream(is);
+ }
+
+ public String readStream(InputStream is) throws IOException {
+ assertNotNull(is);
+ StringBuilder sb = new StringBuilder();
+ is = new BufferedInputStream(is);
+ int ch;
+ while ((ch = is.read()) != -1) {
+ sb.append((char)ch);
+ }
+ is.close();
+ return sb.toString();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ buildDir = new File(System.getProperty("basedir"), "target");
+ installDir = new File(buildDir, "assembly");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java
new file mode 100644
index 0000000000..31e697bb23
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Stream drainer used for draining the out and err streams of an external
+ * process to avoid buffer overflow and deadlock.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class ProcessDrainer {
+
+ // Default time out in seconds
+ private static final int DEFAULT_TIMEOUT = 60;
+
+ // Process whose streams are being drained
+ private Process process;
+
+ // Timeout to wait for the extrenal process to whutdown
+ private int timeout = DEFAULT_TIMEOUT;
+
+ // Executor that is scheduling the draining
+ private ExecutorService executor = Executors.newFixedThreadPool(2);
+
+ /*
+ * Initializes the process to drained.
+ */
+ private ProcessDrainer(Process process) {
+ this.process = process;
+ }
+
+ /*
+ * Initializes the process to drained.
+ */
+ private ProcessDrainer(Process process, int timeout) {
+ this.process = process;
+ this.timeout = timeout;
+ }
+
+ /**
+ * Creates a new instance of the stream drainer for the processed.
+ * @param process Process to be drained.
+ * @return An instance of the stream drainer.
+ */
+ public static ProcessDrainer newInstance(Process process) {
+ return new ProcessDrainer(process);
+ }
+
+ /**
+ * Creates a new instance of the stream drainer for the processed.
+ * @param process Process to be drained.
+ * @param timeout Timeout before which teh drainer stops.
+ * @return An instance of the stream drainer.
+ */
+ public static ProcessDrainer newInstance(Process process, int timeout) {
+ return new ProcessDrainer(process, timeout);
+ }
+
+ /**
+ * Starts draining the stream.
+ */
+ public void drain() {
+
+ executor.execute(new StreamDrainer(process.getErrorStream()));
+ executor.execute(new StreamDrainer(process.getInputStream()));
+
+ executor.shutdown();
+ try {
+ executor.awaitTermination(timeout, TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ return;
+ }
+
+ }
+
+ /*
+ * Scheduled stream drainer.
+ */
+ private class StreamDrainer implements Runnable {
+
+ // Stream to be drained
+ private final InputStream inputStream;
+
+ /*
+ * Initializes the stream to drained.
+ */
+ private StreamDrainer(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /*
+ * Starts draing the stream.
+ */
+ public void run() {
+ try {
+ int count = 0;
+ byte[] buffer = new byte[4096];
+ count = inputStream.read(buffer);
+ while (count != -1) {
+ count = inputStream.read(buffer);
+ }
+ } catch (IOException ex) {
+ }
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
new file mode 100644
index 0000000000..7ac45268ae
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SmokeTestAssemblyContent extends CommandTestCase {
+ public void testLegalFilesArePresent() {
+ assertTrue(installDir.exists());
+ assertTrue(installDir.isDirectory());
+ assertTrue(new File(installDir, "LICENSE.txt").exists());
+ assertTrue(new File(installDir, "NOTICE.txt").exists());
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
new file mode 100644
index 0000000000..f3e7c3e40c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SmokeTestLauncher extends CommandTestCase {
+ private static final String LF = System.getProperty("line.separator");
+ private File launcher;
+ private File testJar;
+
+ public void testLauncherCommandIsPresent() {
+ assertTrue(launcher.exists());
+ }
+
+ public void testLauncherUsage() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java", "-jar", launcher.getAbsolutePath());
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ compareOutput(loadResource("LauncherUsage.txt"), process.getErrorStream());
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(1, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ public void testLauncherWithNoArgs() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java", "-jar", launcher.getAbsolutePath(), testJar.getAbsolutePath());
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ compareOutput("No Args" + LF, process.getInputStream());
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(0, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ public void testReference() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java",
+ "-jar",
+ launcher.getAbsolutePath(),
+ testJar.getAbsolutePath(),
+ "testReference");
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(0, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ launcher = new File(installDir, "bin/launcher.jar");
+ testJar = new File(buildDir, "smoketest.jar");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt
new file mode 100644
index 0000000000..c77e130b05
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt
@@ -0,0 +1 @@
+No component found with id "http://no.such.component"
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
new file mode 100644
index 0000000000..d2b766f8ae
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
@@ -0,0 +1 @@
+usage: java [jvm-options] -jar launcher.jar <componentJar> [apparg1, apparg2, ...]
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/standalone-api/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-standalone/standalone-api/pom.xml.off b/sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off
new file mode 100644
index 0000000000..fa737b4c07
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Standalone Runtime</name>
+ <description>Code to run Tuscany in a standalone application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-host-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
new file mode 100644
index 0000000000..abacda879b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+import java.util.jar.JarFile;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+
+/**
+ * Utility class for installation directory related operations.
+ *
+ * @version $Revision$ $Date$
+ */
+public final class DirectoryHelper {
+
+ /**
+ * Installation directory system property name.
+ */
+ private static final String INSTALL_DIRECTORY_PROPERTY = "tuscany.installDir";
+
+ private DirectoryHelper() {
+ }
+
+ /**
+ * Gets the installation directory based on the location of a class file.
+ * If the system property <code>tuscany.installDir</code> is set then its value is used as the
+ * location of the installation directory. Otherwise, we assume we are running from an
+ * executable jar containing the supplied class and the installation directory is assumed to
+ * be the parent of the directory containing that jar.
+ *
+ * @param clazz the class to use as a way to find the executable jar
+ * @return directory where tuscany standalone server is installed.
+ * @throws IllegalArgumentException if the property is set but its value is not an existing directory
+ * @throws IllegalStateException if the location could not be determined from the location of the class file
+ */
+ public static File getInstallDirectory(Class clazz) throws IllegalStateException, IllegalArgumentException {
+
+ String installDirectoryPath = System.getProperty(INSTALL_DIRECTORY_PROPERTY);
+
+ if (installDirectoryPath != null) {
+ File installDirectory = new File(installDirectoryPath);
+ if (!installDirectory.exists()) {
+ throw new IllegalArgumentException(INSTALL_DIRECTORY_PROPERTY
+ + " property does not refer to an existing directory: " + installDirectory);
+ }
+ return installDirectory;
+ }
+
+ // get the name of the Class's bytecode
+ String name = clazz.getName();
+ int last = name.lastIndexOf('.');
+ if (last != -1) {
+ name = name.substring(last + 1);
+ }
+ name = name + ".class";
+
+ // get location of the bytecode - should be a jar: URL
+ URL url = clazz.getResource(name);
+ if (url == null) {
+ throw new IllegalStateException("Unable to get location of bytecode resource " + name);
+ }
+
+ String jarLocation = url.toString();
+ if (!jarLocation.startsWith("jar:")) {
+ throw new IllegalStateException("Must be run from a jar: " + url);
+ }
+
+ // extract the location of thr jar from the resource URL
+ jarLocation = jarLocation.substring(4, jarLocation.lastIndexOf("!/"));
+ if (!jarLocation.startsWith("file:")) {
+ throw new IllegalStateException("Must be run from a local filesystem: " + jarLocation);
+ }
+
+ File jarFile = new File(URI.create(jarLocation));
+ return jarFile.getParentFile().getParentFile();
+ }
+
+ /**
+ * Get the directory associated with a runtime profile.
+ * If the system property <code>tuscany.profileDir.${profileName}</code> is set then its value
+ * is used as the value for the profile directory. Otherwise, the directory ${installDir}/profiles/${profileName}
+ * is used.
+ *
+ * @param installDir the installation directory
+ * @param profileName tha name of the profile
+ * @return the directory for the the specified profile
+ * @throws FileNotFoundException if the directory does not exist
+ */
+ public static File getProfileDirectory(File installDir, String profileName) throws FileNotFoundException {
+ String propName = "tuscany.profileDir." + profileName;
+ String profilePath = System.getProperty(propName);
+ File profileDir;
+ if (profilePath != null) {
+ profileDir = new File(profilePath);
+ } else {
+ profileDir = new File(new File(installDir, "profiles"), profileName);
+ }
+
+ if (!profileDir.isDirectory()) {
+ throw new FileNotFoundException("Unable to locate profile directory: " + profileDir.toString());
+ }
+ return profileDir;
+ }
+
+ /**
+ * Gets the boot directory where all the boot libraries are stored. This
+ * is expected to be a directory named <code>boot</code> under the install
+ * directory.
+ *
+ * @param installDirectory Tuscany install directory.
+ * @param bootPath Boot path for the runtime.
+ * @return Tuscany boot directory.
+ */
+ public static File getBootDirectory(File installDirectory, String bootPath) {
+
+ File bootDirectory = new File(installDirectory, bootPath);
+ if (!bootDirectory.exists()) {
+ throw new IllegalStateException("Boot directory doesn't exist: " + bootDirectory.getAbsolutePath());
+ }
+ return bootDirectory;
+
+ }
+
+ /**
+ * Gets the boot directory for the specified profile.
+ * If the bootPath is not null then it is used to specify the location of the boot directory
+ * relative to the profile directory. Otherwise, if there is a directory named "boot" relative
+ * to the profile or install directory then it is used.
+ *
+ * @param installDir the installation directory
+ * @param profileDir the profile directory
+ * @param bootPath the path to the boot directory
+ * @return the boot directory
+ * @throws FileNotFoundException if the boot directory does not exist
+ */
+ public static File getBootDirectory(File installDir, File profileDir, String bootPath)
+ throws FileNotFoundException {
+ File bootDir;
+ if (bootPath != null) {
+ bootDir = new File(profileDir, bootPath);
+ } else {
+ bootDir = new File(profileDir, "boot");
+ if (!bootDir.isDirectory()) {
+ bootDir = new File(installDir, "boot");
+ }
+ }
+ if (!bootDir.isDirectory()) {
+ throw new FileNotFoundException("Unable to locate boot directory: " + bootDir);
+ }
+ return bootDir;
+ }
+
+ /**
+ * Create a classloader from all the jar files or subdirectories in a directory.
+ * The classpath for the returned classloader will comprise all jar files and subdirectories
+ * of the supplied directory. Hidden files and those that do not contain a valid manifest will
+ * be silently ignored.
+ *
+ * @param parent the parent for the new classloader
+ * @param directory the directory to scan
+ * @return a classloader whose classpath includes all jar files and subdirectories of the supplied directory
+ */
+ public static ClassLoader createClassLoader(ClassLoader parent, File directory) {
+ File[] jars = directory.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ if (file.isHidden()) {
+ return false;
+ }
+ if (file.isDirectory()) {
+ return true;
+ }
+ try {
+ JarFile jar = new JarFile(file);
+ return jar.getManifest() != null;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+ });
+
+ URL[] urls = new URL[jars.length];
+ for (int i = 0; i < jars.length; i++) {
+ try {
+ urls[i] = jars[i].toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have escaped the URL
+ throw new AssertionError();
+ }
+ }
+
+ return new URLClassLoader(urls, parent);
+ }
+
+ /**
+ * Load properties from the specified file.
+ * If the file does not exist then an empty properties object is returned.
+ *
+ * @param propFile the file to load from
+ * @param defaults defaults for the properties
+ * @return a Properties object loaded from the file
+ * @throws IOException if there was a problem loading the properties
+ */
+ public static Properties loadProperties(File propFile, Properties defaults) throws IOException {
+ Properties props = defaults == null ? new Properties() : new Properties(defaults);
+ FileInputStream is;
+ try {
+ is = new FileInputStream(propFile);
+ } catch (FileNotFoundException e) {
+ return props;
+ }
+ try {
+ props.load(is);
+ return props;
+ } finally {
+ is.close();
+ }
+ }
+
+ /**
+ * Convert a File to a URL. Equivalent to file.toURI().toURL()
+ *
+ * @param file the file to convert
+ * @return the URL for the File
+ */
+ public static URL toURL(File file) {
+ try {
+ return file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have escaped this
+ throw new AssertionError();
+ }
+ }
+
+ public static StandaloneRuntimeInfo createRuntimeInfo(String defaultProfile, Class<?> markerClass) throws IOException {
+ // get profile to use, defaulting to "launcher"
+ String profile = System.getProperty("tuscany.profile", defaultProfile);
+
+ File installDir = getInstallDirectory(markerClass);
+ File profileDir = getProfileDirectory(installDir, profile);
+
+ // load properties for this runtime
+ File propFile = new File(profileDir, "etc/runtime.properties");
+ Properties props = loadProperties(propFile, System.getProperties());
+
+ // online unless the offline property is set
+ boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+ return new StandaloneRuntimeInfoImpl(null, profile, installDir, profileDir, null, online, props);
+
+ }
+
+ public static TuscanyRuntime createRuntime(StandaloneRuntimeInfo runtimeInfo) throws Exception {
+ File installDir = runtimeInfo.getInstallDirectory();
+ File profileDir = runtimeInfo.getProfileDirectory();
+ URL profileURL = toURL(profileDir);
+ ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+
+ // create the classloader for booting the runtime
+ String bootPath = runtimeInfo.getProperty("tuscany.bootDir", null);
+ File bootDir = getBootDirectory(installDir, profileDir, bootPath);
+ ClassLoader bootClassLoader = createClassLoader(hostClassLoader, bootDir);
+
+ // locate the system SCDL
+ URL systemSCDL = new URL(profileURL, runtimeInfo.getProperty("tuscany.systemSCDL", "system.scdl"));
+
+ // locate the implementation
+ String className = runtimeInfo.getProperty("tuscany.runtimeClass",
+ "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
+ Class<?> implClass = Class.forName(className, true, bootClassLoader);
+
+ TuscanyRuntime runtime = (TuscanyRuntime) implClass.newInstance();
+ runtime.setHostClassLoader(hostClassLoader);
+ runtime.setSystemScdl(systemSCDL);
+ runtime.setRuntimeInfo(runtimeInfo);
+ return runtime;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java
new file mode 100644
index 0000000000..0ccb26a7dd
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone;
+
+import java.net.URL;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+
+/**
+ * Extends the tuscany runtime to add the behavious to deploy an
+ * application SCDL.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface StandaloneRuntime extends TuscanyRuntime<StandaloneRuntimeInfo> {
+
+ /**
+ * Deploys the specified application SCDL and runs the lauched component within the deployed composite.
+ *
+ * @param applicationScdl Application SCDL that implements the composite.
+ * @param applicationClassLoader Classloader used to deploy the composite.
+ * @param args Arguments to be passed to the lauched component.
+ * @deprecated This is a hack for deployment and should be removed.
+ */
+ int deployAndRun(URL applicationScdl, ClassLoader applicationClassLoader, String[] args) throws Exception;
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
new file mode 100644
index 0000000000..8e5e18b198
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone;
+
+import java.io.File;
+import java.net.URI;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface StandaloneRuntimeInfo extends RuntimeInfo {
+
+ URI STANDALONE_COMPONENT_URI = URI.create("sca://StandaloneRuntimeInfo");
+
+ /**
+ * Return the directory where the standalone distribution was installed.
+ *
+ * @return the directory where the standalone distribution was installed
+ */
+ File getInstallDirectory();
+
+ /**
+ * Returns the name of this runtime's profile.
+ *
+ * @return the name of this runtime's profile
+ */
+ String getProfileName();
+
+ /**
+ * Returns the directory containing this runtime's profile.
+ *
+ * @return the directory containing this runtime's profile
+ */
+ File getProfileDirectory();
+
+ /**
+ * Return the value of the named property.
+ *
+ * @param name the name of the property
+ * @param defaultValue default value to return if the property is not defined
+ * @return the value of the named property
+ */
+ String getProperty(String name, String defaultValue);
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java
new file mode 100644
index 0000000000..bf1e92b407
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Properties;
+
+import org.apache.tuscany.host.AbstractRuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandaloneRuntimeInfoImpl extends AbstractRuntimeInfo implements StandaloneRuntimeInfo {
+ private final String profileName;
+ private final File profileDirectory;
+ private final File installDirectory;
+ private final Properties properties;
+
+ /**
+ * Initializes the base URL, install directory, application root directory and
+ * online mode.
+ *
+ * @param domain the SCA domain this runtime belongs to
+ * @param profileName the runtime's profile name
+ * @param installDirectory directory containing the standalone installation
+ * @param profileDirectory directory containing this runtime's profile
+ * @param applicationRootDirectory Application root directory.
+ * @param online true if this runtime should consider itself online
+ * @param properties properties for this runtime
+ */
+ public StandaloneRuntimeInfoImpl(final URI domain,
+ final String profileName,
+ final File installDirectory,
+ final File profileDirectory,
+ final File applicationRootDirectory,
+ final boolean online,
+ final Properties properties) {
+ super(domain, applicationRootDirectory, DirectoryHelper.toURL(installDirectory), online, profileName);
+ this.profileName = profileName;
+ this.profileDirectory = profileDirectory;
+ this.properties = properties;
+ this.installDirectory = installDirectory;
+
+ }
+
+ public String getProfileName() {
+ return profileName;
+ }
+
+ public File getProfileDirectory() {
+ return profileDirectory;
+ }
+
+ public File getInstallDirectory() {
+ return installDirectory;
+ }
+
+ public String getProperty(String name, String defaultValue) {
+ return properties.getProperty(name, defaultValue);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-standalone/standalone-host/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-standalone/standalone-host/pom.xml.off b/sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off
new file mode 100644
index 0000000000..f8ef044ab6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Standalone Runtime Host</name>
+ <description>Host code to support a standalone runtime</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>maven</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java
new file mode 100644
index 0000000000..038df9e3b9
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone.host;
+
+import java.io.File;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.loader.IllegalSCDLNameException;
+import org.apache.tuscany.spi.services.VoidService;
+
+import org.apache.tuscany.core.services.extension.AbstractExtensionDeployer;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+
+/**
+ * Service that extends the runtime by loading composites located in a directory.
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class DirectoryScanExtender extends AbstractExtensionDeployer implements VoidService {
+ private final StandaloneRuntimeInfo runtimeInfo;
+ private final String path;
+
+ public DirectoryScanExtender(@Reference StandaloneRuntimeInfo runtimeInfo,
+ @Property(name = "path")String path) {
+ this.runtimeInfo = runtimeInfo;
+ this.path = path;
+ }
+
+ @Init
+ public void init() throws IllegalSCDLNameException {
+ assert runtimeInfo != null;
+ File extensionDir = new File(runtimeInfo.getInstallDirectory(), path);
+ if (!extensionDir.isDirectory()) {
+ // we don't have an extension directory, there's nothing to do
+ return;
+ }
+
+ File[] files = extensionDir.listFiles();
+ for (File file : files) {
+ deployExtension(file);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
new file mode 100644
index 0000000000..23811743e4
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone.host;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.core.monitor.JavaLoggingMonitorFactory;
+import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.core.component.SimpleWorkContext;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.runtime.standalone.host.implementation.launched.Launched;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandaloneRuntimeImpl extends AbstractRuntime<StandaloneRuntimeInfo> implements StandaloneRuntime {
+ JavaLoggingMonitorFactory monitorFactory;
+ StandaloneMonitor monitor;
+
+ public StandaloneRuntimeImpl() {
+ super(StandaloneRuntimeInfo.class);
+ monitorFactory = new JavaLoggingMonitorFactory();
+ setMonitorFactory(monitorFactory);
+ monitor = monitorFactory.getMonitor(StandaloneMonitor.class);
+ }
+
+ /**
+ * Deploys the specified application SCDL and runs the lauched component within the deployed composite.
+ *
+ * @param applicationScdl Application SCDL that implements the composite.
+ * @param applicationClassLoader Classloader used to deploy the composite.
+ * @param args Arguments to be passed to the lauched component.
+ * @deprecated This is a hack for deployment and should be removed.
+ */
+ public int deployAndRun(URL applicationScdl, ClassLoader applicationClassLoader, String[] args) throws Exception {
+
+ URI compositeUri = new URI("/test/composite");
+ URI compositeBase = new URI("/test/composite/");
+
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(applicationScdl);
+ impl.setClassLoader(applicationClassLoader);
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(compositeUri, impl);
+ try {
+ Collection<Component> components = getDeployer().deploy(null, definition);
+ for (Component component : components) {
+ component.start();
+ }
+ ScopeRegistry scopeRegistry = getScopeRegistry();
+ ScopeContainer<URI> container = scopeRegistry.getScopeContainer(Scope.COMPOSITE);
+ container.startContext(compositeUri, compositeUri);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, compositeUri);
+ WorkContext workContext = new SimpleWorkContext();
+ workContext.setIdentifier(Scope.COMPOSITE, compositeUri);
+ PojoWorkContextTunnel.setThreadWorkContext(workContext);
+ try {
+ return run(impl, args, compositeBase, workContext);
+ } finally {
+ container.stopContext(compositeUri);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, null);
+ }
+ } catch (Exception e) {
+ monitor.runError(e);
+ }
+ return -1;
+
+ }
+
+ private int run(CompositeImplementation impl, String[] args, URI compositeUri, WorkContext workContext) throws Exception {
+ CompositeComponentType<?, ?, ?> componentType = impl.getComponentType();
+ Map<String, ComponentDefinition<? extends Implementation<?>>> components = componentType.getComponents();
+ for (Map.Entry<String, ComponentDefinition<? extends Implementation<?>>> entry : components.entrySet()) {
+ String name = entry.getKey();
+ ComponentDefinition<? extends Implementation<?>> launchedDefinition = entry.getValue();
+ Implementation implementation = launchedDefinition.getImplementation();
+ if (implementation.getClass().isAssignableFrom(Launched.class)) {
+ return run(compositeUri.resolve(name), implementation, args, workContext);
+ }
+ }
+ return -1;
+ }
+
+ private int run(URI componentUri, Implementation implementation, String[] args, WorkContext workContext)
+ throws TargetInvokerCreationException, InvocationTargetException {
+ Launched launched = (Launched) implementation;
+ PojoComponentType launchedType = launched.getComponentType();
+ Map services = launchedType.getServices();
+ JavaMappedService testService = (JavaMappedService) services.get("main");
+ Operation<?> operation = testService.getServiceContract().getOperations().get("main");
+ Component component = getComponentManager().getComponent(componentUri);
+ TargetInvoker targetInvoker = component.createTargetInvoker("main", operation);
+ Object result = targetInvoker.invokeTarget(new Object[]{args}, TargetInvoker.NONE, workContext);
+ try {
+ return int.class.cast(result);
+ } catch (ClassCastException e) {
+ return 0;
+ }
+ }
+
+ public interface StandaloneMonitor {
+ @LogLevel("SEVERE")
+ void runError(Exception e);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java
new file mode 100644
index 0000000000..93771ee942
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone.host.implementation.launched;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Launched extends AtomicImplementation<PojoComponentType> {
+ private String className;
+ private String factoryName;
+
+ public Launched(String className, String factoryName) {
+ this.className = className;
+ this.factoryName = factoryName;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getFactoryName() {
+ return factoryName;
+ }
+
+ public void setFactoryName(String factoryName) {
+ this.factoryName = factoryName;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java
new file mode 100644
index 0000000000..642076ca29
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone.host.implementation.launched;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.Parameter;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+
+/**
+ * @version $Revsion$ $Date$
+ * <p/>
+ * TODO This is a straight copy from the JUnit component builder
+ */
+public class LaunchedComponentBuilder extends ComponentBuilderExtension<Launched> {
+
+ private ResourceHost host;
+
+ @Reference
+ public void setHost(ResourceHost host) {
+ this.host = host;
+ }
+
+ @Override
+ protected Class<Launched> getImplementationType() {
+ return Launched.class;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Component build(ComponentDefinition<Launched> definition, DeploymentContext deployment)
+ throws BuilderConfigException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ definition.getImplementation().getComponentType();
+ Class<?> implClass = componentType.getImplClass();
+
+ PojoConfiguration configuration = new PojoConfiguration();
+ if (definition.getInitLevel() != null) {
+ configuration.setInitLevel(definition.getInitLevel());
+ } else {
+ configuration.setInitLevel(componentType.getInitLevel());
+ }
+ if (componentType.getMaxAge() > 0) {
+ configuration.setMaxAge(componentType.getMaxAge());
+ } else if (componentType.getMaxIdleTime() > 0) {
+ configuration.setMaxIdleTime(componentType.getMaxIdleTime());
+ }
+ Method initMethod = componentType.getInitMethod();
+ if (initMethod != null) {
+ configuration.setInitInvoker(new MethodEventInvoker(initMethod));
+ }
+ Method destroyMethod = componentType.getDestroyMethod();
+ if (destroyMethod != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker(destroyMethod));
+ }
+
+ configuration.setProxyService(proxyService);
+ configuration.setWorkContext(workContext);
+ configuration.setImplementationClass(implClass);
+ configuration.setGroupId(deployment.getGroupId());
+
+ // setup property injection sites
+ for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
+ configuration.addPropertySite(property.getName(), property.getMember());
+ }
+
+ // setup reference injection sites
+ for (JavaMappedReference reference : componentType.getReferences().values()) {
+ Member member = reference.getMember();
+ if (member != null) {
+ // could be null if the reference is mapped to a constructor
+ configuration.addReferenceSite(reference.getUri().getFragment(), member);
+ }
+ }
+
+ for (Resource resource : componentType.getResources().values()) {
+ Member member = resource.getMember();
+ if (member != null) {
+ // could be null if the resource is mapped to a constructor
+ configuration.addResourceSite(resource.getName(), member);
+ }
+ }
+
+ // setup constructor injection
+ ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
+ Constructor<?> constr = ctorDef.getConstructor();
+ PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
+ configuration.setInstanceFactory(instanceFactory);
+ configuration.setConstructor(ctorDef);
+ configuration.setName(definition.getUri());
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+
+ // handle properties
+ handleProperties(definition, component);
+
+ // handle resources
+ handleResources(componentType, component);
+
+ handleCallbackSites(componentType, configuration);
+
+ if (componentType.getConversationIDMember() != null) {
+ component.addConversationIDFactory(componentType.getConversationIDMember());
+ }
+
+ return component;
+ }
+
+ private void handleCallbackSites(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ PojoConfiguration configuration) {
+ for (JavaMappedService service : componentType.getServices().values()) {
+ // setup callback injection sites
+ if (service.getCallbackReferenceName() != null) {
+ // Only if there is a callback reference in the service
+ configuration.addCallbackSite(service.getCallbackReferenceName(), service.getCallbackMember());
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void handleResources(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ JavaAtomicComponent component) {
+
+ for (Resource resource : componentType.getResources().values()) {
+ ObjectFactory<?> objectFactory = resource.getObjectFactory();
+ if (objectFactory != null) {
+ component.addResourceFactory(resource.getName(), objectFactory);
+ } else {
+ String name = resource.getName();
+ boolean optional = resource.isOptional();
+ Class<Object> type = (Class<Object>) resource.getType();
+ ResourceObjectFactory<Object> factory;
+ String mappedName = resource.getMappedName();
+ if (mappedName == null) {
+ // by type
+ factory = new ResourceObjectFactory<Object>(type, optional, host);
+ } else {
+ factory = new ResourceObjectFactory<Object>(type, mappedName, optional, host);
+ }
+ component.addResourceFactory(name, factory);
+ }
+ }
+ }
+
+ private void handleProperties(ComponentDefinition<Launched> definition, JavaAtomicComponent component) {
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java
new file mode 100644
index 0000000000..c3575ae95b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone.host.implementation.launched;
+
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class LaunchedComponentTypeLoader extends ComponentTypeLoaderExtension<Launched> {
+ private static final URI SERVICE_NAME = URI.create("#main");
+ private Introspector introspector;
+
+ public LaunchedComponentTypeLoader(@Reference LoaderRegistry loaderRegistry,
+ @Reference IntrospectionRegistry introspector) {
+ super(loaderRegistry);
+ this.introspector = introspector;
+ }
+
+ @Override
+ protected Class<Launched> getImplementationClass() {
+ return Launched.class;
+ }
+
+ public void load(
+ Launched implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+ String className = implementation.getClassName();
+ Class<?> implClass;
+ try {
+ implClass = deploymentContext.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException(className, e);
+ }
+ PojoComponentType componentType = loadByIntrospection(implementation, deploymentContext, implClass);
+ implementation.setComponentType(componentType);
+ }
+
+ protected PojoComponentType loadByIntrospection(
+ Launched implementation,
+ DeploymentContext deploymentContext,
+ Class<?> implClass) throws ProcessingException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>(implClass);
+ introspector.introspect(implClass, componentType, deploymentContext);
+
+ ServiceContract launchedContract = generateContract(implClass);
+ JavaMappedService testService = new JavaMappedService(SERVICE_NAME, launchedContract, false);
+ componentType.add(testService);
+ return componentType;
+ }
+
+ private static final DataType<List<DataType<Type>>> INPUT_TYPE;
+ private static final DataType<Type> OUTPUT_TYPE;
+ private static final List<DataType<Type>> FAULT_TYPE;
+
+ static {
+ List<DataType<Type>> paramDataTypes = new ArrayList<DataType<Type>>();
+ //noinspection unchecked
+ paramDataTypes.add(new DataType(null, String[].class, String[].class));
+ INPUT_TYPE = new DataType<List<DataType<Type>>>("idl:input", Object[].class, paramDataTypes);
+ OUTPUT_TYPE = new DataType<Type>(null, Object.class, Object.class);
+ FAULT_TYPE = Collections.emptyList();
+ }
+
+ protected ServiceContract generateContract(Class<?> implClass) {
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ Operation<Type> operation = new Operation<Type>("main", INPUT_TYPE, OUTPUT_TYPE, FAULT_TYPE);
+ operations.put("main", operation);
+ return new LaunchedServiceContract(operations);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java
new file mode 100644
index 0000000000..7718e02838
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.standalone.host.implementation.launched;
+
+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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LaunchedLoader extends LoaderExtension<Launched> {
+ private static final QName LAUNCHED = new QName("http://tuscany.apache.org/xmlns/sca/2.0-alpha", "launched");
+
+ public LaunchedLoader(@Reference LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return LAUNCHED;
+ }
+
+ public Launched load(
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ String className = reader.getAttributeValue(null, "class");
+ String factoryName = reader.getAttributeValue(null, "factory");
+ return new Launched(className, factoryName);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java
new file mode 100644
index 0000000000..820093917a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone.host.implementation.launched;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Revison$ $Date$
+ *
+ */
+public class LaunchedServiceContract extends ServiceContract<Type> {
+
+ public LaunchedServiceContract(Map<String, Operation<Type>> operations) {
+ setOperations(operations);
+ }
+}
+
diff --git a/sandbox/old/contrib/runtime-webapp/plugin.war/LICENSE.txt b/sandbox/old/contrib/runtime-webapp/plugin.war/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/runtime-webapp/plugin.war/NOTICE.txt b/sandbox/old/contrib/runtime-webapp/plugin.war/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-webapp/plugin.war/pom.xml.off b/sandbox/old/contrib/runtime-webapp/plugin.war/pom.xml.off
new file mode 100644
index 0000000000..6243b60b0a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/pom.xml.off
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany War Plugin</name>
+ <description>A plugin for Apache Maven that adds a Tuscany runtime to a war.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <url>scp://people.apache.org/www/incubator.apache.org/tuscany/plugins/tuscany-war-plugin</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <goalPrefix>tuscany</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/Dependency.java b/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/Dependency.java
new file mode 100644
index 0000000000..07817eeca0
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/Dependency.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.plugin.war;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+
+/**
+ * Represents a configured tuscany dependency for boot and extension libraries.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Dependency {
+
+ /**
+ * JAR type artifact.
+ */
+ private static final String TYPE_JAR = "jar";
+
+ /**
+ * Group Id that is injected in from configuration.
+ */
+ private String groupId;
+
+ /**
+ * Artifact Id that is injected in from configuration.
+ */
+ private String artifactId;
+
+ /**
+ * Version that is injected in from configuration.
+ */
+ private String version;
+
+ /**
+ * Default constructor.
+ */
+ public Dependency() {
+ }
+
+ /**
+ * Initializes the field.
+ *
+ * @param groupId Group id.
+ * @param artifactId Artifact id.
+ * @param version Artifact version.
+ */
+ public Dependency(String groupId, String artifactId, String version) {
+ super();
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+
+ /**
+ * Gets the artifact using the specified artifact factory.
+ *
+ * @param artifactFactory Artifact factory to use.
+ * @return Artifact identified by the dependency.
+ */
+ public Artifact getArtifact(ArtifactFactory artifactFactory) {
+ return artifactFactory.createArtifact(groupId, artifactId, version, Artifact.SCOPE_RUNTIME, TYPE_JAR);
+ }
+
+ /**
+ * Checks whether the specified artifact has the same artifact id.
+ *
+ * @param artifact Artifact to be matched.
+ * @return True if the specified artifact has the same id.
+ */
+ public boolean match(Artifact artifact) {
+ return artifact.getArtifactId().equals(artifactId);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/TuscanyWarMojo.java b/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/TuscanyWarMojo.java
new file mode 100644
index 0000000000..5eb8cdcba3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/src/main/java/org/apache/tuscany/plugin/war/TuscanyWarMojo.java
@@ -0,0 +1,508 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.plugin.war;
+
+import java.beans.XMLEncoder;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipException;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Build the tuscany war file by adding the tuscany dependencies.
+ *
+ * Performs the following tasks.
+ *
+ * <ul>
+ * <li>Adds the boot dependencies transitively to WEB-INF/tuscany/boot</li>
+ * <li>By default boot libraries are transitively resolved from webapp-host</li>
+ * <li>The version of boot libraries can be specified using configuration/runTimeVersion element</li>
+ * <li>Boot libraries can be overridden using the configuration/bootLibs element in the plugin</li>
+ * <li>Adds the extension artifacts specified using configuration/extensions to WEB-INF/tuscany/extensions</li>
+ * <li>If configuration/loadExtensionsDependency is set to true extension dependencies are transitivel loaded</li>
+ * <li>Extension dependencies are loaded into WEB-INF/tuscany/repository directory in a Maven repo format</li>
+ * <li>Extension dependency metadata is written to WEB-INF/tuscany/repository/dependency.metadata file</li>
+ * </ul>
+ * @goal tuscany-war
+ * @phase package
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class TuscanyWarMojo extends AbstractMojo {
+
+ /**
+ * Tuscany path.
+ */
+ private static final String TUSCANY_PATH = "WEB-INF/tuscany/";
+
+ /**
+ * Tuscany boot path.
+ */
+ private static final String BOOT_PATH = TUSCANY_PATH + "boot/";
+
+ /**
+ * Tuscany extension path.
+ */
+ private static final String EXTENSION_PATH = TUSCANY_PATH + "extensions/";
+
+ /**
+ * Tuscany repository path.
+ */
+ private static final String REPOSITORY_PATH = TUSCANY_PATH + "repository/";
+
+ /**
+ * Artifact metadata source.
+ *
+ * @component
+ */
+ public ArtifactMetadataSource metadataSource;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ public ArtifactFactory artifactFactory;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+ * @required
+ * @readonly
+ */
+ public ArtifactResolver resolver;
+
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ public ArtifactRepository localRepository;
+
+ /**
+ * List of Remote Repositories used by the resolver
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ * @required
+ */
+ public List remoteRepositories;
+
+ /**
+ * The directory for the generated WAR.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ public String outputDirectory;
+
+ /**
+ * The directory for the generated WAR.
+ *
+ * @parameter
+ */
+ public Dependency[] bootLibs;
+
+ /**
+ * The directory for the generated WAR.
+ *
+ * @parameter
+ */
+ public Dependency[] extensions = new Dependency[0];
+
+ /**
+ * The directory for the generated WAR.
+ *
+ * @parameter
+ */
+ public Dependency[] dependencies = new Dependency[0];
+
+ /**
+ * The name of the generated WAR.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ public String warName;
+
+ /**
+ * A flag to indicate whether extension dependencies should be resolved transitively.
+ *
+ * @parameter
+ */
+ public boolean loadExtensionDependencies;
+
+ /**
+ * The default version of the runtime to use.
+ *
+ * @parameter
+ */
+ public String runTimeVersion;
+
+ /**
+ * WEB-INF jar files.
+ */
+ public Set<String> packagedLibs = new HashSet<String>();
+
+ /**
+ * Transitive dependencies for extensions.
+ */
+ public Map<String, Set<String>> transDepenedencyMap = new HashMap<String, Set<String>>();
+
+ /**
+ * Executes the MOJO.
+ */
+ public void execute() throws MojoExecutionException {
+
+ JarFile originalWar;
+ JarOutputStream newWar = null;
+ File originalWarFile = null;
+ File newWarFile = null;
+
+ boolean success = false;
+
+ if (runTimeVersion == null) {
+ try {
+ runTimeVersion = getPluginVersion();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ if (bootLibs == null) {
+ Dependency dependancy = new Dependency("org.apache.tuscany.sca.runtime.webapp",
+ "webapp-host",
+ runTimeVersion);
+ bootLibs = new Dependency[] {dependancy};
+ }
+
+ try {
+ originalWarFile = new File(outputDirectory, warName + ".war");
+ originalWar = new JarFile(originalWarFile);
+
+ newWarFile = new File(outputDirectory, warName + "-temp.war");
+ newWar = new JarOutputStream(new FileOutputStream(newWarFile));
+
+ copyOriginal(originalWar, newWar);
+
+ addEntry(newWar, TUSCANY_PATH);
+ addEntry(newWar, BOOT_PATH);
+ addEntry(newWar, EXTENSION_PATH);
+ addEntry(newWar, REPOSITORY_PATH);
+
+ for (Dependency dependency : bootLibs) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory), true)) {
+ addArtifact(newWar, BOOT_PATH, art);
+ }
+ }
+
+ for (Dependency dependency : extensions) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory), loadExtensionDependencies)) {
+ if (dependency.match(art)) {
+ addArtifact(newWar, EXTENSION_PATH, art);
+ }
+
+ // Load dependencies even for the extension itself
+ if (loadExtensionDependencies) {
+ loadTransitiveDependencies(newWar, art);
+ }
+
+ }
+ }
+
+ for (Dependency dependency : dependencies) {
+ for (Artifact art : resolveArtifact(dependency.getArtifact(artifactFactory), loadExtensionDependencies)) {
+ loadTransitiveDependencies(newWar, art);
+ }
+ }
+
+ writeDependencyMetadata(newWar);
+
+ success = true;
+
+ } catch (Exception ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
+ } finally {
+ IOUtils.closeQuietly(newWar);
+ }
+
+ if (success) {
+ if (!originalWarFile.delete()) {
+ throw new MojoExecutionException("Unable to rename war file");
+ }
+ if (!newWarFile.renameTo(originalWarFile)) {
+ throw new MojoExecutionException("Unable to rename war file");
+ }
+ }
+
+ }
+
+ /**
+ * Adds an entry to the JAR failing safe for duplicate.
+ *
+ * @param jar JAR to which the entry is added.
+ * @param entry Entry to be added.
+ * @return True if added successfully.
+ * @throws IOException In case of an IO error.
+ */
+ private boolean addEntry(JarOutputStream jar, String entry) throws IOException {
+ try {
+ jar.putNextEntry(new JarEntry(entry));
+ return true;
+ } catch (ZipException duplicateEntry) {
+ getLog().info(duplicateEntry.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * Writes the dependency metadata.
+ * @param newWar WAR to which the metadata is written.
+ * @throws IOException In case of an IO error.
+ */
+ private void writeDependencyMetadata(JarOutputStream newWar) throws IOException {
+
+ FileOutputStream depMapOutStream = null;
+ FileInputStream depMapInStream = null;
+
+ try {
+ String metadataFile = "dependency.metadata";
+
+ File file = new File(outputDirectory, "webapp");
+ file = new File(file, REPOSITORY_PATH);
+ file.mkdirs();
+
+ file = new File(file, metadataFile);
+ file.createNewFile();
+
+ depMapOutStream = new FileOutputStream(file);
+ XMLEncoder xmlEncoder = new XMLEncoder(depMapOutStream);
+ xmlEncoder.writeObject(transDepenedencyMap);
+ xmlEncoder.close();
+
+ if (addEntry(newWar, REPOSITORY_PATH + metadataFile)) {
+ depMapInStream = new FileInputStream(file);
+ IOUtils.copy(depMapInStream, newWar);
+ }
+
+ } finally {
+ IOUtils.closeQuietly(depMapOutStream);
+ IOUtils.closeQuietly(depMapInStream);
+ }
+
+ }
+
+ /**
+ * Builds the transitive dependencies for artifacts.
+ *
+ * @param newWar WARto which the artifacts are added.
+ * @param art Extension artifact.
+ * @throws IOException In case of an unexpected IO error.
+ * @throws ArtifactResolutionException If the artifact cannot be resolved.
+ * @throws ArtifactNotFoundException If the artifact is not found.
+ * @throws ArtifactMetadataRetrievalException In case of error in retrieving metadata.
+ */
+ private void loadTransitiveDependencies(JarOutputStream newWar, Artifact art) throws IOException, ArtifactResolutionException,
+ ArtifactNotFoundException, ArtifactMetadataRetrievalException {
+
+ String artPath = art.getGroupId() + "/" + art.getArtifactId() + "/" + art.getVersion() + "/";
+ String path = REPOSITORY_PATH + artPath;
+ addArtifact(newWar, path, art);
+
+ Set<String> transDepenedenyList = new HashSet<String>();
+ transDepenedencyMap.put(artPath, transDepenedenyList);
+
+ // Get the transitive dependencies for each dependency.
+ for (Artifact transArt : resolveArtifact(art, true)) {
+ String transArtPath = transArt.getGroupId() + "/" + transArt.getArtifactId() + "/" + transArt.getVersion() + "/";
+ if (addArtifact(newWar, REPOSITORY_PATH + transArtPath, transArt)) {
+ transDepenedenyList.add(transArtPath + transArt.getFile().getName());
+ }
+ }
+
+ }
+
+ /**
+ * Resolves the specified artifact.
+ *
+ * @param artifact Artifact to be resolved.
+ * @param transitive Whether to resolve transitively.
+ * @return A set of resolved artifacts.
+ * @throws IOException In case of an unexpected IO error.
+ * @throws ArtifactResolutionException If the artifact cannot be resolved.
+ * @throws ArtifactNotFoundException If the artifact is not found.
+ * @throws ArtifactMetadataRetrievalException In case of error in retrieving metadata.
+ */
+ private Set<Artifact> resolveArtifact(Artifact artifact, boolean transitive) throws IOException, ArtifactResolutionException,
+ ArtifactNotFoundException, ArtifactMetadataRetrievalException {
+
+ Set<Artifact> resolvedArtifacts = new HashSet<Artifact>();
+
+ // Resolve the artifact
+ resolver.resolve(artifact, remoteRepositories, localRepository);
+ resolvedArtifacts.add(artifact);
+
+ if (!transitive) {
+ return resolvedArtifacts;
+ }
+
+ // Transitively resolve all the dependencies
+ ResolutionGroup resolutionGroup = metadataSource.retrieve(artifact, localRepository, remoteRepositories);
+ ArtifactResolutionResult result = resolver.resolveTransitively(resolutionGroup.getArtifacts(), artifact, remoteRepositories, localRepository,
+ metadataSource);
+
+ // Add the artifacts to the deployment unit
+ for (Object depArtifact : result.getArtifacts()) {
+ resolvedArtifacts.add((Artifact) depArtifact);
+ }
+ return resolvedArtifacts;
+
+ }
+
+ /**
+ * Adds the artifact to the war file.
+ *
+ * @param newWar War file to which the artifact is added.
+ * @param path Path within the war file where artifact is added.
+ * @param artifact Artifact to be added.
+ * @throws IOException In case of an unexpected IO error.
+ * @return true if the artifact was added
+ */
+ private boolean addArtifact(JarOutputStream newWar, String path, Artifact artifact) throws IOException {
+
+ FileInputStream artifactStream = null;
+ FileOutputStream fileOutputStream = null;
+
+ try {
+
+ File artifactFile = artifact.getFile();
+ // For extensions, we'll add it even the packagedLibs has it
+ if ((!EXTENSION_PATH.equals(path)) && packagedLibs.contains(artifactFile.getName())) {
+ return false;
+ }
+ artifactStream = new FileInputStream(artifactFile);
+
+ newWar.putNextEntry(new JarEntry(path + artifactFile.getName()));
+
+ File file = new File(outputDirectory, "webapp");
+ file = new File(file, path);
+ file.mkdirs();
+
+ file = new File(file, artifactFile.getName());
+ fileOutputStream = new FileOutputStream(file);
+
+ IOUtils.copy(artifactStream, fileOutputStream);
+ IOUtils.closeQuietly(artifactStream);
+
+ artifactStream = new FileInputStream(artifactFile);
+ IOUtils.copy(artifactStream, newWar);
+
+ packagedLibs.add(artifactFile.getName());
+
+ getLog().info("Processed " + path + artifactFile.getName());
+
+ return true;
+
+ } finally {
+ IOUtils.closeQuietly(artifactStream);
+ IOUtils.closeQuietly(fileOutputStream);
+ }
+
+ }
+
+ /**
+ * Copies the original war file.
+ *
+ * @param originalWar Original war file.
+ * @param newWar New war file.
+ * @throws IOException In case of an unexpected IO error.
+ */
+ private void copyOriginal(JarFile originalWar, JarOutputStream newWar) throws IOException {
+
+ Enumeration entries = originalWar.entries();
+ packagedLibs.clear();
+
+ while (entries.hasMoreElements()) {
+
+ JarEntry entry = (JarEntry) entries.nextElement();
+ InputStream jarEntryStream = null;
+
+ try {
+ jarEntryStream = originalWar.getInputStream(entry);
+ newWar.putNextEntry(entry);
+ IOUtils.copy(jarEntryStream, newWar);
+ String name = entry.getName();
+
+ if (name.endsWith(".jar")) {
+ packagedLibs.add(name.substring(name.lastIndexOf("/") + 1));
+ }
+ } finally {
+ IOUtils.closeQuietly(jarEntryStream);
+ }
+
+ }
+
+ originalWar.close();
+
+ }
+
+ private String getPluginVersion() throws IOException {
+ Properties pomProperties = new Properties();
+ String propFile = "/META-INF/maven/org.apache.tuscany/tuscany-war-plugin/pom.properties";
+ InputStream is = getClass().getResourceAsStream(propFile);
+ try {
+ pomProperties.load(is);
+ return pomProperties.getProperty("version");
+ } finally {
+ IOUtils.closeQuietly(is);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/apt/usage.apt b/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/apt/usage.apt
new file mode 100644
index 0000000000..3a13e07e16
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/apt/usage.apt
@@ -0,0 +1,46 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+Usage
+
+ The <<<tuscany-war-plugin>>> is associated with the <<<package>>> phase of the build lifecycle
+ and is typically included in the build definition for your project:
+
++---+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
++---+
+
+ The plugin adds the jars needed by the webapp integration code into WEB-INF/lib
+ so that they are included on the web application's classpath.
+
+ It also adds the jars needed by the webapp runtime into WEB-INF/tuscany/lib.
+ These are loaded by the integration code and do not appear on the web application's classpath. \ No newline at end of file
diff --git a/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/site.xml b/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/site.xml
new file mode 100644
index 0000000000..caa04a13fe
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/plugin.war/src/site/site.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+<!--
+ <item name="FAQ" href="faq.html"/>
+-->
+ </menu>
+<!--
+ <menu name="Examples">
+ </menu>
+-->
+ </body>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/pom.xml.off b/sandbox/old/contrib/runtime-webapp/pom.xml.off
new file mode 100644
index 0000000000..829065b201
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/pom.xml.off
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>runtime</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Webapp SCA Runtime</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>webapp-api</module>
+ <module>webapp-host</module>
+ <module>plugin.war</module>
+ <module>smoketest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <!-- for the release profile exclude the smoketest as the gpg plugin cannot handle war packaging -->
+ <id>release</id>
+ <modules>
+ <module>webapp-api</module>
+ <module>webapp-host</module>
+ <module>plugin.war</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/LICENSE.txt b/sandbox/old/contrib/runtime-webapp/smoketest/LICENSE.txt
new file mode 100644
index 0000000000..9601ead3f6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/LICENSE.txt
@@ -0,0 +1,1407 @@
+
+ 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:
+
+Netscape Public License V1.1
+
+ AMENDMENTS
+
+ The Netscape Public License Version 1.1 ("NPL") consists of the
+ Mozilla Public License Version 1.1 with the following Amendments,
+ including Exhibit A-Netscape Public License. Files identified with
+ "Exhibit A-Netscape Public License" are governed by the Netscape
+ Public License Version 1.1.
+
+ Additional Terms applicable to the Netscape Public License.
+ I. Effect.
+ These additional terms described in this Netscape Public
+ License -- Amendments shall apply to the Mozilla Communicator
+ client code and to all Covered Code under this License.
+
+ II. "Netscape's Branded Code" means Covered Code that Netscape
+ distributes and/or permits others to distribute under one or more
+ trademark(s) which are controlled by Netscape but which are not
+ licensed for use under this License.
+
+ III. Netscape and logo.
+ This License does not grant any rights to use the trademarks
+ "Netscape", the "Netscape N and horizon" logo or the "Netscape
+ lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
+ "Smart Browsing" even if such marks are included in the Original
+ Code or Modifications.
+
+ IV. Inability to Comply Due to Contractual Obligation.
+ Prior to licensing the Original Code under this License, Netscape
+ has licensed third party code for use in Netscape's Branded Code.
+ To the extent that Netscape is limited contractually from making
+ such third party code available under this License, Netscape may
+ choose to reintegrate such code into Covered Code without being
+ required to distribute such code in Source Code form, even if
+ such code would otherwise be considered "Modifications" under
+ this License.
+
+ V. Use of Modifications and Covered Code by Initial Developer.
+ V.1. In General.
+ The obligations of Section 3 apply to Netscape, except to
+ the extent specified in this Amendment, Section V.2 and V.3.
+
+ V.2. Other Products.
+ Netscape may include Covered Code in products other than the
+ Netscape's Branded Code which are released by Netscape
+ during the two (2) years following the release date of the
+ Original Code, without such additional products becoming
+ subject to the terms of this License, and may license such
+ additional products on different terms from those contained
+ in this License.
+
+ V.3. Alternative Licensing.
+ Netscape may license the Source Code of Netscape's Branded
+ Code, including Modifications incorporated therein, without
+ such Netscape Branded Code becoming subject to the terms of
+ this License, and may license such Netscape Branded Code on
+ different terms from those contained in this License.
+
+ VI. Litigation.
+ Notwithstanding the limitations of Section 11 above, the
+ provisions regarding litigation in Section 11(a), (b) and (c) of
+ the License shall apply to all disputes relating to this License.
+
+ EXHIBIT A-Netscape Public License.
+
+ "The contents of this file are subject to the Netscape 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/NPL/
+
+ 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 Mozilla Communicator client code, released
+ March 31, 1998.
+
+ The Initial Developer of the Original Code is Netscape
+ Communications Corporation. Portions created by Netscape are
+ Copyright (C) 1998-1999 Netscape Communications Corporation. 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 NPL, 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 NPL or the
+ [___] License."
+
+ ----------------------------------------------------------------------
+
+ MOZILLA PUBLIC LICENSE
+ Version 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 NPL 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/old/contrib/runtime-webapp/smoketest/NOTICE.txt b/sandbox/old/contrib/runtime-webapp/smoketest/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-webapp/smoketest/pom.xml.off b/sandbox/old/contrib/runtime-webapp/smoketest/pom.xml.off
new file mode 100644
index 0000000000..9dee9cff73
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/pom.xml.off
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-smoketest</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany WebApp Smoketest</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <configuration>
+ <container>
+ <containerId>jetty6x</containerId>
+ <type>embedded</type>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+ <cargo.servlet.port>8088</cargo.servlet.port>
+ </properties>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/SmokeTest*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloService.java b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloService.java
new file mode 100644
index 0000000000..87566cbba4
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.webapp.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting();
+}
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..9cf2ced4d8
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/HelloServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.webapp.smoketest;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting")String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/TestServlet.java b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/TestServlet.java
new file mode 100644
index 0000000000..49dd12d6f4
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/java/org/apache/tuscany/sca/runtime/webapp/smoketest/TestServlet.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.webapp.smoketest;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+
+import org.osoa.sca.ComponentContext;
+
+import org.apache.tuscany.runtime.webapp.Constants;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestServlet extends HttpServlet {
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ PrintWriter out = response.getWriter();
+ String test = request.getParameter("test");
+ if ("context".equals(test)) {
+ ComponentContext context = (ComponentContext) getServletContext().getAttribute(Constants.CONTEXT_ATTRIBUTE);
+ if (context == null) {
+ response.sendError(500, "Context was not bound");
+ return;
+ }
+ out.print("component URI is " + context.getURI());
+ } else {
+ response.sendError(500, "No test specified");
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/default.scdl b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/default.scdl
new file mode 100644
index 0000000000..9a21678676
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/default.scdl
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="WebappSmoketestComposite">
+
+ <component name="smoketest">
+ <tuscany:webapp>
+ <reference name="hello" interface="org.apache.tuscany.sca.runtime.webapp.smoketest.HelloService"/>
+ </tuscany:webapp>
+ <reference name="hello" target="HelloComponent"/>
+ </component>
+
+ <component name="HelloComponent">
+ <implementation.java class="org.apache.tuscany.sca.runtime.webapp.smoketest.HelloServiceImpl"/>
+ <property name="greeting">Hello World</property>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/web.xml b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..fe6975f514
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>Apache Tuscany Webapp Smoketest</display-name>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <context-param>
+ <param-name>tuscany.component</param-name>
+ <param-value>smoketest</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.apache.tuscany.sca.runtime.webapp.smoketest.TestServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/smoketest</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/sandbox/old/contrib/runtime-webapp/smoketest/src/test/java/org/apache/tuscany/sca/runtime/webapp/smoketest/SmokeTestContext.java b/sandbox/old/contrib/runtime-webapp/smoketest/src/test/java/org/apache/tuscany/sca/runtime/webapp/smoketest/SmokeTestContext.java
new file mode 100644
index 0000000000..e0510848f1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/smoketest/src/test/java/org/apache/tuscany/sca/runtime/webapp/smoketest/SmokeTestContext.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.webapp.smoketest;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SmokeTestContext extends TestCase {
+ private URL base;
+
+ public void testContext() throws IOException {
+ URL url = new URL(base, "smoketest?test=context");
+ String result = getContent(url);
+ assertEquals("component URI is http://locahost/sca/smoketest", result);
+ }
+
+ private String getContent(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ Reader reader = new InputStreamReader(connection.getInputStream());
+ StringBuilder result = new StringBuilder();
+ int ch;
+ while ((ch = reader.read()) != -1) {
+ result.append((char)ch);
+ }
+ reader.close();
+ assertEquals(200, connection.getResponseCode());
+ return result.toString();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ base = new URL("http://localhost:8088/webapp-smoketest/");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/.ruleset b/sandbox/old/contrib/runtime-webapp/webapp-api/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/LICENSE.txt b/sandbox/old/contrib/runtime-webapp/webapp-api/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-webapp/webapp-api/NOTICE.txt b/sandbox/old/contrib/runtime-webapp/webapp-api/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-webapp/webapp-api/pom.xml.off b/sandbox/old/contrib/runtime-webapp/webapp-api/pom.xml.off
new file mode 100644
index 0000000000..a9a7959c8c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/pom.xml.off
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Web Application Runtime</name>
+ <description>Integration code to run Tuscany in a Web application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-host-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/Constants.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/Constants.java
new file mode 100644
index 0000000000..ef209c05ee
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/Constants.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+/**
+ * Constants used by the web application booter
+ *
+ * @version $Rev$ $Date$
+ */
+public final class Constants {
+
+ /**
+ * Name of the servlet context-param that should contain the component id for the webapp.
+ */
+ public static final String COMPOSITE_PARAM = "tuscany.composite";
+
+ /**
+ * Name of the servlet context-param that should contain the component id for the webapp.
+ */
+ public static final String COMPONENT_PARAM = "tuscany.component";
+
+ /**
+ * Servlet context-param name for user-specified application SCDL path.
+ */
+ static final String APPLICATION_SCDL_PATH_PARAM = "tuscany.applicationScdlPath";
+
+ /**
+ * Default application SCDL path.
+ */
+ public static final String APPLICATION_SCDL_PATH_DEFAULT = "/WEB-INF/default.scdl";
+
+ /**
+ * Servlet context-param name for setting if the runtime is online.
+ */
+ public static final String ONLINE_PARAM = "tuscany.online";
+
+ /**
+ * Name of the context attribute that contains the ComponentContext.
+ */
+ public static final String CONTEXT_ATTRIBUTE = "tuscany.context";
+
+ /**
+ * Name of the parameter that defines the name of webapp resource containing bootstrap jars.
+ */
+ static final String BOOTDIR_PARAM = "tuscany.bootDir";
+
+ /**
+ * Default value for BOOTDIR_PARAM.
+ */
+ static final String BOOTDIR_DEFAULT = "/WEB-INF/tuscany/boot";
+
+ /**
+ * Name of the parameter that defines the class to load to launch the runtime.
+ */
+ static final String RUNTIME_PARAM = "tuscany.runtimeImpl";
+
+ /**
+ * Name of the default webapp runtime implementation.
+ */
+ static final String RUNTIME_DEFAULT = "org.apache.tuscany.runtime.webapp.WebappRuntimeImpl";
+
+ /**
+ * Servlet context-param name for user-specified system SCDL path.
+ */
+ static final String SYSTEM_SCDL_PATH_PARAM = "tuscany.systemScdlPath";
+
+ /**
+ * Default webapp system SCDL path.
+ */
+ static final String SYSTEM_SCDL_PATH_DEFAULT = "META-INF/tuscany/webapp.scdl";
+
+ /**
+ * Context attribute to which the Tuscany runtime for this servlet context is stored.
+ */
+ static final String RUNTIME_ATTRIBUTE = "tuscany.runtime";
+
+ /**
+ * Servlet context-param name for the path to the composite to set as the webb app composite
+ */
+ static final String CURRENT_COMPOSITE_PATH_PARAM = "tuscany.currentCompositePath";
+
+ /**
+ * Servlet context-param name for user-specified system SCDL path.
+ */
+ static final String EXTENSION_SCDL_PATH_PARAM = "tuscany.extensionScdlPath";
+
+ /**
+ * Default path for extensions if no "extensionScdlPath param is specified
+ */
+ static final String DEFAULT_EXTENSION_PATH_PARAM = "/WEB-INF/tuscany/extensions";
+
+ /**
+ * Servlet context-param name for system monitoring level. Supported values are the names of statics defined in
+ * java.util.logging.Level. If absent, no monitoring will take place.
+ */
+ static final String SYSTEM_MONITORING_PARAM = "tuscany.monitoringLevel";
+
+ private Constants() {
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/InvalidResourcePath.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/InvalidResourcePath.java
new file mode 100644
index 0000000000..3d1353de25
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/InvalidResourcePath.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+/**
+ * Denotes an invalid or non-existing path for a resource required by the runtime bootstrap
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourcePath extends TuscanyInitException {
+
+ public InvalidResourcePath(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherMonitor.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherMonitor.java
new file mode 100644
index 0000000000..5936240481
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherMonitor.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * A monitor interface used during runtime bootstrap
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletLauncherMonitor {
+
+ @LogLevel("DEBUG")
+ void deployExtension(String path);
+
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java
new file mode 100644
index 0000000000..dce4fa7393
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.net.URL;
+import java.net.URI;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+import org.apache.tuscany.host.runtime.ShutdownException;
+import static org.apache.tuscany.runtime.webapp.Constants.COMPOSITE_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.COMPONENT_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.ONLINE_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_DEFAULT;
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_PARAM;
+
+/**
+ * Launches a Tuscany runtime in a web application, loading information from servlet context parameters. This listener
+ * manages one runtime per servlet context; the lifecycle of that runtime corresponds to the the lifecycle of the
+ * associated servlet context.
+ * <p/>
+ * The runtime is launched in a child classloader of the web application, thereby providing isolation between
+ * application and system artifacts. Application code only has access to the SCA API and may not reference Tuscany
+ * system artifacts directly.
+ * <p/>
+ * The <code>web.xml</code> of a web application embedding Tuscany must have entries for this listener and {@link
+ * TuscanySessionListener}. The latter notifies the runtime of session creation and expiration events through a
+ * "bridging" contract, {@link WebappRuntime}. The <code>web.xml</code> may also optionally be configured with entries
+ * for {@link TuscanyFilter} and {@link TuscanyServlet}. The former must be mapped to all urls that execute "unmanaged"
+ * code which accesses the Tuscany runtime though the SCA API, for example, JSPs and Servlets. The latter forwards
+ * service requests into the runtime, by default requests sent to URLs relative to the context path beginning with
+ * <code>/services</code>.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyContextListener implements ServletContextListener {
+
+ public void contextInitialized(ServletContextEvent event) {
+ ClassLoader webappClassLoader = Thread.currentThread().getContextClassLoader();
+ ServletContext servletContext = event.getServletContext();
+ WebappUtil utils = getUtils(servletContext);
+ try {
+ // FIXME work this out from the servlet context
+ String defaultComposite = "http://locahost/sca";
+ URI compositeId = new URI(utils.getInitParameter(COMPOSITE_PARAM, defaultComposite));
+ URI componentId = new URI(utils.getInitParameter(COMPONENT_PARAM, "webapp"));
+ String scdlPath = utils.getInitParameter(APPLICATION_SCDL_PATH_PARAM, APPLICATION_SCDL_PATH_DEFAULT);
+ URL scdl = servletContext.getResource(scdlPath);
+
+ boolean online = Boolean.valueOf(utils.getInitParameter(ONLINE_PARAM, "true"));
+ WebappRuntimeInfo info = new WebappRuntimeInfoImpl(servletContext,
+ servletContext.getResource("/WEB-INF/tuscany/"),
+ online);
+ ClassLoader bootClassLoader = utils.getBootClassLoader(webappClassLoader);
+ URL systemScdl = utils.getSystemScdl(bootClassLoader);
+
+ WebappRuntime runtime = utils.getRuntime(bootClassLoader);
+ runtime.setServletContext(servletContext);
+ runtime.setRuntimeInfo(info);
+ runtime.setHostClassLoader(webappClassLoader);
+ runtime.setSystemScdl(systemScdl);
+ runtime.initialize();
+ servletContext.setAttribute(RUNTIME_ATTRIBUTE, runtime);
+
+ runtime.deploy(compositeId, scdl, componentId);
+ } catch (TuscanyRuntimeException e) {
+ servletContext.log(e.getMessage(), e);
+ e.printStackTrace();
+ throw e;
+ } catch (Throwable e) {
+ servletContext.log(e.getMessage(), e);
+ e.printStackTrace();
+ throw new TuscanyInitException(e);
+ }
+ }
+
+ protected WebappUtil getUtils(ServletContext servletContext) {
+ return new WebappUtilImpl(servletContext);
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+ WebappRuntime runtime = (WebappRuntime) servletContext.getAttribute(RUNTIME_ATTRIBUTE);
+ if (runtime == null) {
+ return;
+ }
+ servletContext.removeAttribute(RUNTIME_ATTRIBUTE);
+ try {
+ runtime.destroy();
+ } catch (ShutdownException e) {
+ servletContext.log("Error destroying runtume", e);
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java
new file mode 100644
index 0000000000..e1433014b2
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletContext;
+
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+
+/**
+ * Maps an incoming request and the current composite context to the composite component for the web application. This
+ * filter must be applied to all web application urls that execute unmanaged code (e.g. JSPs and Servlets) which
+ * accesses the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyFilter implements Filter {
+ private WebappRuntime runtime;
+
+ public void init(FilterConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ runtime = (WebappRuntime) servletContext.getAttribute(RUNTIME_ATTRIBUTE);
+ if (runtime == null) {
+ throw new ServletException("Tuscany is not configured for the web application");
+ }
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain)
+ throws IOException, ServletException {
+ try {
+ runtime.startRequest();
+ filterChain.doFilter(req, resp);
+ } finally {
+ runtime.stopRequest();
+ }
+ }
+
+ public void destroy() {
+ runtime = null;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyInitException.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyInitException.java
new file mode 100644
index 0000000000..a929dd6307
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyInitException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception indicating that there was a problem starting the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyInitException extends TuscanyRuntimeException {
+ public TuscanyInitException(String string) {
+ super(string);
+ }
+
+ public TuscanyInitException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TuscanyInitException(String string, Throwable throwable) {
+ super(string, throwable);
+ }
+
+ public TuscanyInitException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public TuscanyInitException(Throwable throwable) {
+ super(throwable);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyRequestListener.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyRequestListener.java
new file mode 100644
index 0000000000..325532aef6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyRequestListener.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Notifies the Tuscany runtime of session creation and expiration events.
+ *
+ * @version $Rev: 441961 $ $Date: 2006-09-10 11:48:29 -0400 (Sun, 10 Sep 2006) $
+ */
+public class TuscanyRequestListener implements ServletRequestListener {
+ private WebappRuntime runtime;
+
+ public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
+
+ final ServletContext context = servletRequestEvent.getServletContext();
+ getRuntime(context);
+ ServletRequest servletRequest = servletRequestEvent.getServletRequest();
+ if (servletRequest instanceof HttpServletRequest) {
+ HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+ HttpSession session = httpServletRequest.getSession(false);
+ runtime.httpRequestEnded(session == null ? null : session.getId());
+
+ }
+
+ }
+
+ public void requestInitialized(ServletRequestEvent servletRequestEvent) {
+
+ final ServletContext context = servletRequestEvent.getServletContext();
+ getRuntime(context);
+ ServletRequest servletRequest = servletRequestEvent.getServletRequest();
+ if (servletRequest instanceof HttpServletRequest) {
+ runtime.httpRequestStarted((HttpServletRequest) servletRequest);
+
+ }
+
+ }
+
+ protected WebappRuntime getRuntime(final ServletContext context) {
+ if (runtime == null) {
+
+ runtime = (WebappRuntime) context.getAttribute(RUNTIME_ATTRIBUTE);
+ if (runtime == null) {
+ context.log("requestInitialized", new ServletException("Tuscany runtime not configured"));
+ return null;
+ }
+ }
+ return runtime;
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyServlet.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyServlet.java
new file mode 100644
index 0000000000..3132559fdd
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyServlet.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import java.io.IOException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.tuscany.host.servlet.ServletRequestInjector;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+
+/**
+ * A servlet that forwards requests intended for SCA services into the Tuscany runtime via a ServletRequestInjector.
+ * This servlet is typically mapped to relative paths beginning with <code>/services</code> in the <code>web.xml</code>
+ * <p/>
+ * TODO a better URL mapping scheme out to be implemented that corresponds to the SCA specification
+ */
+public class TuscanyServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ private ServletRequestInjector requestInjector;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ WebappRuntime runtime = (WebappRuntime) servletContext.getAttribute(RUNTIME_ATTRIBUTE);
+ if (runtime == null) {
+ throw new ServletException("Tuscany runtime not configured for web application");
+ }
+ requestInjector = runtime.getRequestInjector();
+ }
+
+ @Override
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ requestInjector.service(req, res);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanySessionListener.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanySessionListener.java
new file mode 100644
index 0000000000..0335c7bc6a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanySessionListener.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+
+/**
+ * Notifies the Tuscany runtime of session creation and expiration events.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanySessionListener implements HttpSessionListener {
+ private WebappRuntime runtime;
+
+ public void sessionCreated(HttpSessionEvent event) {
+ if (runtime == null) {
+ ServletContext context = event.getSession().getServletContext();
+ runtime = (WebappRuntime) context.getAttribute(RUNTIME_ATTRIBUTE);
+ if (runtime == null) {
+ context.log("Error on session creation", new ServletException("Tuscany runtime not configured"));
+ return;
+ }
+ }
+ runtime.sessionCreated(event);
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event) {
+ if (runtime != null) {
+ runtime.sessionDestroyed(event);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java
new file mode 100644
index 0000000000..b74cc6e67e
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.net.URI;
+import java.net.URL;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.servlet.ServletRequestInjector;
+
+/**
+ * The contract for artifacts loaded in the web application classloader to comminicate with the Tuscany runtime loaded
+ * in a child classloader. For example, filters and listeners may use this interface to notify the runtime of the web
+ * container events.
+ *
+ * @version $Rev$ $Date$
+ * @see TuscanyFilter
+ * @see TuscanySessionListener
+ */
+public interface WebappRuntime extends HttpSessionListener, TuscanyRuntime<WebappRuntimeInfo> {
+ /**
+ * Returns the ServletContext associated with this runtime.
+ *
+ * @return the ServletContext associated with this runtime
+ */
+ ServletContext getServletContext();
+
+ /**
+ * Sets the ServletContext associated with this runtime.
+ *
+ * @param servletContext the ServletContext associated with this runtime
+ */
+ void setServletContext(ServletContext servletContext);
+
+ /**
+ * Returns the request injector for the runtime
+ * @return the runtime's request injector
+ */
+ ServletRequestInjector getRequestInjector();
+
+ /**
+ * Notification that the web application has begun servicing a request
+ */
+ void startRequest();
+
+ /**
+ * Notification that the web application has stopped servicing a request
+ */
+ void stopRequest();
+
+ /**
+ * Request has been started for the given request.
+ * @param request the servlet request
+ */
+ void httpRequestStarted(HttpServletRequest request);
+
+ /**
+ * Request has been ended with the given session id.
+ * @param id the session id
+ */
+ void httpRequestEnded(Object id);
+
+ /**
+ * Temporary method for deploying SCDL supplied with an application to the runtime.
+ *
+ * @param compositeId the id of the component that the supplied SCDL should implement
+ * @param applicationScdl the location of an application composite
+ * @param componentId the id of the component that should be bound to the webapp
+ * @throws InitializationException if there was a problem initializing the composite
+ */
+ @Deprecated
+ void deploy(URI compositeId, URL applicationScdl, URI componentId) throws InitializationException;
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java
new file mode 100644
index 0000000000..3047a30bb0
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WebappRuntimeInfo extends RuntimeInfo {
+ /**
+ * Returns the ServletContext associated with this webapp runtime.
+ *
+ * @return the ServletContext associated with this webapp runtime.
+ */
+ ServletContext getServletContext();
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java
new file mode 100644
index 0000000000..1f08fa2790
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URI;
+import javax.servlet.ServletContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappRuntimeInfoImpl implements WebappRuntimeInfo {
+ private final ServletContext servletContext;
+ private final URL baseURL;
+ private final boolean online;
+
+ public WebappRuntimeInfoImpl(ServletContext servletContext, URL baseURL, boolean online) {
+ this.servletContext = servletContext;
+ this.baseURL = baseURL;
+ this.online = online;
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public URL getBaseURL() {
+ return baseURL;
+ }
+
+ public File getInstallDirectory() {
+ return new File("");
+ }
+
+ public File getApplicationRootDirectory() {
+ return new File("");
+ }
+
+ public boolean isOnline() {
+ return online;
+ }
+
+ public URI getDomain() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRuntimeId() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java
new file mode 100644
index 0000000000..263436bd96
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WebappUtil {
+
+ String getApplicationName();
+
+ WebappRuntime getRuntime(ClassLoader bootClassLoader) throws TuscanyInitException;
+
+ /**
+ * Return the classloader that should be used to boot the Tuscany runtime. This will be a child of the web
+ * application's ClassLoader.
+ *
+ * @param webappClassLoader the web application's classloader
+ * @return a classloader that can be used to load the Tuscany runtime classes
+ */
+ ClassLoader getBootClassLoader(ClassLoader webappClassLoader) throws InvalidResourcePath;
+
+ URL getSystemScdl(ClassLoader bootClassLoader) throws InvalidResourcePath;
+
+ URL getApplicationScdl(ClassLoader bootClassLoader) throws InvalidResourcePath;
+
+ URL getScdlURL(String path, ClassLoader classLoader) throws MalformedURLException;
+
+ /**
+ * Return a init parameter from the servlet context or provide a default.
+ *
+ * @param name the name of the parameter
+ * @param value the default value
+ * @return the value of the specified parameter, or the default if not defined
+ */
+ String getInitParameter(String name, String value);
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java
new file mode 100644
index 0000000000..fcaec7f8ac
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Set;
+import javax.servlet.ServletContext;
+
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_DEFAULT;
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.BOOTDIR_DEFAULT;
+import static org.apache.tuscany.runtime.webapp.Constants.BOOTDIR_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_DEFAULT;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.SYSTEM_SCDL_PATH_DEFAULT;
+import static org.apache.tuscany.runtime.webapp.Constants.SYSTEM_SCDL_PATH_PARAM;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappUtilImpl implements WebappUtil {
+ private final ServletContext servletContext;
+
+ public WebappUtilImpl(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ public WebappRuntime getRuntime(ClassLoader bootClassLoader) throws TuscanyInitException {
+ try {
+ String className = getInitParameter(RUNTIME_PARAM, RUNTIME_DEFAULT);
+ return (WebappRuntime) bootClassLoader.loadClass(className).newInstance();
+ } catch (InstantiationException e) {
+ throw new TuscanyInitException(e);
+ } catch (IllegalAccessException e) {
+ throw new TuscanyInitException(e);
+ } catch (ClassNotFoundException e) {
+ throw new TuscanyInitException("Runtime Implementation not found", e);
+ }
+ }
+
+ public ClassLoader getBootClassLoader(ClassLoader webappClassLoader) throws InvalidResourcePath {
+ String bootDirName = getInitParameter(BOOTDIR_PARAM, BOOTDIR_DEFAULT);
+ Set paths = servletContext.getResourcePaths(bootDirName);
+ if (paths == null) {
+ // nothing in boot directory, assume everything is in the webapp classloader
+ return webappClassLoader;
+ }
+ URL[] urls = new URL[paths.size()];
+ int i = 0;
+ for (Object path : paths) {
+ try {
+ urls[i++] = servletContext.getResource((String) path);
+ } catch (MalformedURLException e) {
+ throw new InvalidResourcePath(APPLICATION_SCDL_PATH_PARAM, path.toString(), e);
+ }
+ }
+ return new URLClassLoader(urls, webappClassLoader);
+ }
+
+ public URL getSystemScdl(ClassLoader bootClassLoader) throws InvalidResourcePath {
+ String path = getInitParameter(SYSTEM_SCDL_PATH_PARAM, SYSTEM_SCDL_PATH_DEFAULT);
+ try {
+ return getScdlURL(path, bootClassLoader);
+ } catch (MalformedURLException e) {
+ throw new InvalidResourcePath(SYSTEM_SCDL_PATH_PARAM, path, e);
+ }
+ }
+
+ public String getApplicationName() {
+ String name = servletContext.getServletContextName();
+ if (name == null) {
+ name = "application";
+ }
+ return name;
+ }
+
+ public URL getApplicationScdl(ClassLoader bootClassLoader) throws InvalidResourcePath {
+ String path = getInitParameter(APPLICATION_SCDL_PATH_PARAM, APPLICATION_SCDL_PATH_DEFAULT);
+ try {
+ return getScdlURL(path, bootClassLoader);
+ } catch (MalformedURLException e) {
+ throw new InvalidResourcePath(APPLICATION_SCDL_PATH_PARAM, path, e);
+ }
+ }
+
+ public URL getScdlURL(String path, ClassLoader classLoader) throws MalformedURLException {
+ URL ret = null;
+ if (path.charAt(0) == '/') {
+ // user supplied an absolute path - look up as a webapp resource
+ ret = servletContext.getResource(path);
+ }
+ if (ret == null) {
+ // user supplied a relative path - look up as a boot classpath resource
+ ret = classLoader.getResource(path);
+ }
+ return ret;
+ }
+
+ public String getInitParameter(String name, String value) {
+ String result = servletContext.getInitParameter(name);
+ if (result != null && result.length() != 0) {
+ return result;
+ }
+ return value;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyContextListenerTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyContextListenerTestCase.java
new file mode 100644
index 0000000000..aa237da01c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyContextListenerTestCase.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URI;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+
+import junit.framework.TestCase;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.eq;
+import static org.easymock.classextension.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.isA;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
+
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.APPLICATION_SCDL_PATH_DEFAULT;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TuscanyContextListenerTestCase extends TestCase {
+ private String contextName;
+ private ServletContext context;
+ private TuscanyContextListener listener;
+ private ClassLoader cl;
+ private ClassLoader bootClassLoader;
+ private URL systemUrl;
+ private URL scdl;
+ private WebappUtil utils;
+ private String compositeId;
+
+ public void testInitializationUsingDefaults() throws Exception {
+ ServletContextEvent event = createMock(ServletContextEvent.class);
+ expect(event.getServletContext()).andReturn(context);
+ replay(event);
+
+ WebappRuntime runtime = createMock(WebappRuntime.class);
+ expect(utils.getBootClassLoader(cl)).andReturn(bootClassLoader);
+ expect(utils.getInitParameter("tuscany.composite", compositeId)).andReturn(compositeId);
+ expect(utils.getInitParameter("tuscany.component", contextName)).andReturn(contextName);
+ expect(utils.getInitParameter("tuscany.online", "true")).andReturn("true");
+ expect(utils.getInitParameter(APPLICATION_SCDL_PATH_PARAM, APPLICATION_SCDL_PATH_DEFAULT))
+ .andReturn(APPLICATION_SCDL_PATH_DEFAULT);
+ expect(utils.getRuntime(bootClassLoader)).andReturn(runtime);
+ expect(utils.getSystemScdl(bootClassLoader)).andReturn(systemUrl);
+ replay(utils);
+
+ expect(context.getResource("/WEB-INF/tuscany/")).andReturn(null);
+ expect(context.getResource(APPLICATION_SCDL_PATH_DEFAULT)).andReturn(scdl);
+ context.setAttribute(eq(Constants.RUNTIME_ATTRIBUTE), isA(WebappRuntime.class));
+ replay(context);
+ replay(cl);
+ replay(bootClassLoader);
+ expect(listener.getUtils(context)).andReturn(utils);
+ replay(listener);
+ runtime.setServletContext(context);
+ runtime.setRuntimeInfo(isA(WebappRuntimeInfo.class));
+ runtime.setHostClassLoader(cl);
+ runtime.setSystemScdl(systemUrl);
+ runtime.initialize();
+ runtime.deploy(URI.create(compositeId), scdl, URI.create(contextName));
+ replay(runtime);
+
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(cl);
+ listener.contextInitialized(event);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCl);
+ }
+ verify(event);
+ verify(utils);
+ verify(context);
+ verify(listener);
+ verify(cl);
+ verify(bootClassLoader);
+ verify(runtime);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Method getUtilsMethod = TuscanyContextListener.class.getDeclaredMethod("getUtils", ServletContext.class);
+ utils = createMock(WebappUtil.class);
+ listener = createMock(TuscanyContextListener.class, new Method[]{getUtilsMethod});
+ context = createMock(ServletContext.class);
+ cl = createMock(ClassLoader.class);
+ bootClassLoader = createMock(ClassLoader.class);
+ systemUrl = new URL("file:/system.scdl");
+ scdl = new URL("file:/app.scdl");
+ contextName = "webapp";
+ compositeId = "http://locahost/sca";
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyFilterTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyFilterTestCase.java
new file mode 100644
index 0000000000..9d811df46c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyFilterTestCase.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.io.IOException;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TuscanyFilterTestCase extends TestCase {
+ private TuscanyFilter filter;
+ private FilterConfig config;
+ private ServletContext servletContext;
+ private WebappRuntime runtime;
+ private ServletRequest request;
+ private ServletResponse response;
+ private FilterChain chain;
+
+ public void testFilterInit() {
+ EasyMock.expect(config.getServletContext()).andReturn(servletContext);
+ EasyMock.expect(servletContext.getAttribute(RUNTIME_ATTRIBUTE)).andReturn(runtime);
+
+ EasyMock.replay(servletContext);
+ EasyMock.replay(config);
+ EasyMock.replay(runtime);
+ try {
+ filter.init(config);
+ } catch (ServletException e) {
+ fail(e.getMessage());
+ }
+ EasyMock.verify(servletContext);
+ EasyMock.verify(config);
+ EasyMock.verify(runtime);
+ }
+
+ public void testFilterInitWithNoRuntimeConfigured() {
+ EasyMock.expect(config.getServletContext()).andReturn(servletContext);
+ EasyMock.expect(servletContext.getAttribute(RUNTIME_ATTRIBUTE)).andReturn(null);
+
+ EasyMock.replay(servletContext);
+ EasyMock.replay(config);
+ EasyMock.replay(runtime);
+ try {
+ filter.init(config);
+ fail("Expected a ServletException");
+ } catch (ServletException e) {
+ // OK
+ }
+ EasyMock.verify(servletContext);
+ EasyMock.verify(config);
+ EasyMock.verify(runtime);
+ }
+
+ public void testContextIsAssociatedWithThread() throws ServletException, IOException {
+ EasyMock.expect(config.getServletContext()).andReturn(servletContext);
+ EasyMock.expect(servletContext.getAttribute(RUNTIME_ATTRIBUTE)).andReturn(runtime);
+ EasyMock.replay(servletContext);
+ EasyMock.replay(config);
+ filter.init(config);
+
+ chain.doFilter(EasyMock.same(request), EasyMock.same(response));
+ EasyMock.replay(chain);
+ runtime.startRequest();
+ runtime.stopRequest();
+ EasyMock.replay(runtime);
+ try {
+ filter.doFilter(request, response, chain);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ EasyMock.verify(chain);
+ EasyMock.verify(runtime);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ filter = new TuscanyFilter();
+ config = EasyMock.createMock(FilterConfig.class);
+ servletContext = EasyMock.createMock(ServletContext.class);
+ runtime = EasyMock.createMock(WebappRuntime.class);
+ request = EasyMock.createMock(ServletRequest.class);
+ response = EasyMock.createMock(ServletResponse.class);
+ chain = EasyMock.createMock(FilterChain.class);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyServletTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyServletTestCase.java
new file mode 100644
index 0000000000..5213ae9cb1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanyServletTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.host.servlet.ServletRequestInjector;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * Verifies {@link TuscanyServlet} properly services a request
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyServletTestCase extends TestCase {
+
+ public void testRequestInjection() throws Exception {
+ ServletRequest req = createNiceMock(ServletRequest.class);
+ ServletResponse resp = createNiceMock(ServletResponse.class);
+ ServletRequestInjector injector = createMock(ServletRequestInjector.class);
+ injector.service(eq(req), eq(resp));
+ EasyMock.replay(injector);
+ WebappRuntime runtime = createMock(WebappRuntime.class);
+ expect(runtime.getRequestInjector()).andReturn(injector);
+ replay(runtime);
+ ServletContext context = createNiceMock(ServletContext.class);
+ EasyMock.expect(context.getAttribute(RUNTIME_ATTRIBUTE)).andReturn(runtime);
+ EasyMock.replay(context);
+ TuscanyServlet servlet = new TuscanyServlet();
+ ServletConfig config = createMock(ServletConfig.class);
+ expect(config.getServletContext()).andReturn(context);
+ replay(config);
+ servlet.init(config);
+ servlet.service(req, resp);
+ verify(context);
+ verify(injector);
+ }
+
+ public void testRuntimeNotConfigured() throws Exception {
+ ServletContext context = createNiceMock(ServletContext.class);
+ TuscanyServlet servlet = new TuscanyServlet();
+ ServletConfig config = createMock(ServletConfig.class);
+ expect(config.getServletContext()).andReturn(context);
+ replay(config);
+ try {
+ servlet.init(config);
+ fail();
+ } catch (ServletException e) {
+ //expected
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanySessionListenerTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanySessionListenerTestCase.java
new file mode 100644
index 0000000000..cdce50cc2b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/TuscanySessionListenerTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+
+import junit.framework.TestCase;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies {@link org.apache.tuscany.runtime.webapp.TuscanySessionListener} notifies the runtime of session events
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanySessionListenerTestCase extends TestCase {
+
+ public void testSessionPropagated() throws Exception {
+ WebappRuntime runtime = EasyMock.createNiceMock(WebappRuntime.class);
+ runtime.sessionCreated(EasyMock.isA(HttpSessionEvent.class));
+ runtime.sessionDestroyed(EasyMock.isA(HttpSessionEvent.class));
+ EasyMock.replay(runtime);
+ ServletContext context = EasyMock.createNiceMock(ServletContext.class);
+ EasyMock.expect(context.getAttribute(RUNTIME_ATTRIBUTE)).andReturn(runtime);
+ EasyMock.replay(context);
+ HttpSession session = EasyMock.createNiceMock(HttpSession.class);
+ EasyMock.expect(session.getServletContext()).andReturn(context);
+ EasyMock.replay(session);
+ HttpSessionEvent event = new HttpSessionEvent(session);
+ TuscanySessionListener listener = new TuscanySessionListener();
+ listener.sessionCreated(event);
+ listener.sessionDestroyed(event);
+ EasyMock.verify(context);
+ EasyMock.verify(runtime);
+ }
+
+ /**
+ * Verifies an error is logged when no runtime is configured
+ *
+ * @throws Exception
+ */
+ public void testRuntimeNotConfigured() throws Exception {
+ ServletContext context = EasyMock.createNiceMock(ServletContext.class);
+ context.log(EasyMock.isA(String.class), EasyMock.isA(ServletException.class));
+ EasyMock.replay(context);
+ TuscanySessionListener listener = new TuscanySessionListener();
+ HttpSession session = EasyMock.createNiceMock(HttpSession.class);
+ EasyMock.expect(session.getServletContext()).andReturn(context);
+ EasyMock.replay(session);
+ HttpSessionEvent event = new HttpSessionEvent(session);
+ listener.sessionCreated(event);
+ EasyMock.verify(context);
+ }
+
+ public void testSessionDestroyedBeforeCreated() throws Exception {
+ TuscanySessionListener listener = new TuscanySessionListener();
+ listener.sessionDestroyed(null);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java
new file mode 100644
index 0000000000..f865a4e740
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-api/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.servlet.ServletContext;
+
+import junit.framework.TestCase;
+import static org.easymock.classextension.EasyMock.*;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappUtilTestCase extends TestCase {
+ private ServletContext context;
+ private WebappUtilImpl listener;
+ private ClassLoader cl;
+ private URL systemUrl;
+
+
+ public void testGetInitParameterWhenSpecified() {
+ String name = "name";
+ String value = "default";
+ expect(context.getInitParameter(name)).andReturn(value);
+ replay(context);
+
+ assertEquals(value, listener.getInitParameter(name, "default"));
+ verify(context);
+ }
+
+ public void testGetInitParameterUsingDefault() {
+ String name = "name";
+ String value = "default";
+ expect(context.getInitParameter(name)).andReturn(null);
+ replay(context);
+
+ assertEquals(value, listener.getInitParameter(name, value));
+ verify(context);
+ }
+
+ public void testGetInitParameterWithZeroLength() {
+ String name = "name";
+ String value = "default";
+ expect(context.getInitParameter(name)).andReturn("");
+ replay(context);
+
+ assertEquals(value, listener.getInitParameter(name, value));
+ verify(context);
+ }
+
+ public void testGetScdlFromWebapp() throws MalformedURLException {
+ String path = "/WEB-INF/test";
+ expect(context.getResource(path)).andReturn(systemUrl);
+ replay(context);
+ replay(cl);
+ assertSame(systemUrl, listener.getScdlURL(path, cl));
+ verify(context);
+ verify(cl);
+ }
+
+ public void testGetScdlFromWebappMissing() throws MalformedURLException {
+ String path = "/WEB-INF/test";
+ expect(context.getResource(path)).andReturn(null);
+ replay(context);
+ expect(cl.getResource(path)).andReturn(null);
+ replay(cl);
+ assertNull(listener.getScdlURL(path, cl));
+ verify(context);
+ verify(cl);
+ }
+
+ public void testGetScdlFromWebappMalformed() throws MalformedURLException {
+ String path = "/WEB-INF/test";
+ expect(context.getResource(path)).andThrow(new MalformedURLException());
+ replay(context);
+ replay(cl);
+ try {
+ listener.getScdlURL(path, cl);
+ fail();
+ } catch (MalformedURLException e) {
+ // OK
+ }
+ verify(context);
+ verify(cl);
+ }
+
+ public void testGetScdlFromClasspath() throws MalformedURLException {
+ String path = "META-INF/test";
+ replay(context);
+ expect(cl.getResource(path)).andReturn(systemUrl);
+ replay(cl);
+ assertSame(systemUrl, listener.getScdlURL(path, cl));
+ verify(context);
+ verify(cl);
+ }
+
+ public void testGetScdlFromClasspathMissing() throws MalformedURLException {
+ String path = "META-INF/test";
+ replay(context);
+ expect(cl.getResource(path)).andReturn(null);
+ replay(cl);
+ assertNull(listener.getScdlURL(path, cl));
+ verify(context);
+ verify(cl);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ context = createMock(ServletContext.class);
+ listener = new WebappUtilImpl(context);
+ cl = createMock(ClassLoader.class);
+ systemUrl = new URL("file:/system.scdl");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/.ruleset b/sandbox/old/contrib/runtime-webapp/webapp-host/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/LICENSE.txt b/sandbox/old/contrib/runtime-webapp/webapp-host/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/runtime-webapp/webapp-host/NOTICE.txt b/sandbox/old/contrib/runtime-webapp/webapp-host/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/runtime-webapp/webapp-host/pom.xml.off b/sandbox/old/contrib/runtime-webapp/webapp-host/pom.xml.off
new file mode 100644
index 0000000000..751bbca302
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/pom.xml.off
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-host</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Web Application Host</name>
+ <description>Host code to run Tuscany in a Web application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>maven</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionId.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionId.java
new file mode 100644
index 0000000000..8d3f1153ba
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionId.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tuscany.core.component.ScopeIdentifier;
+
+/**
+ * Implements a <code>ScopeIdentifier</code> for a Servlet-based transport.
+ * Wraps an <code>HttpServletRequest</code> so that the session id associated
+ * with the current request may be lazily retrieved by the module context - i.e.
+ * if a session context or session-scoped component is not accessed, no session
+ * is created.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LazyHTTPSessionId implements ScopeIdentifier {
+
+ private HttpServletRequest request;
+
+ //----------------------------------
+ // Constructors
+ //----------------------------------
+
+ public LazyHTTPSessionId(HttpServletRequest request) {
+ this.request = request;
+ }
+
+ //----------------------------------
+ // Methods
+ //----------------------------------
+
+ /**
+ * Returns the session identifier
+ *
+ * @see org.apache.tuscany.core.context.ScopeIdentifier#getIdentifier()
+ */
+ public Object getIdentifier() {
+ return request.getSession(true);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletHostImpl.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletHostImpl.java
new file mode 100644
index 0000000000..17dbe127d3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletHostImpl.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.EventFilter;
+import org.apache.tuscany.spi.event.EventPublisher;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.model.Scope;
+
+import org.apache.tuscany.core.component.event.HttpRequestEnded;
+import org.apache.tuscany.core.component.event.HttpRequestStart;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.host.servlet.ServletRequestInjector;
+
+/**
+ * A <code>ServletHost</code> implementation that forwards requests to registered servlets
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ServletHost.class)
+@EagerInit
+public class ServletHostImpl implements ServletHost, ServletRequestInjector, EventPublisher {
+ protected Map<String, Servlet> servlets;
+ protected ScopeRegistry registry;
+ protected WorkContext workContext;
+
+ public ServletHostImpl() {
+ this.servlets = new HashMap<String, Servlet>();
+ }
+
+ @Reference(required = false)
+ public void setSessionScopeContainer(ScopeRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Reference(required = false)
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
+ assert req instanceof HttpServletRequest : "implementation only supports HttpServletRequest";
+ String path = ((HttpServletRequest) req).getPathInfo();
+ Servlet servlet = servlets.get(path);
+ if (servlet == null) {
+ throw new IllegalStateException("No servlet registered for path: " + path);
+ }
+ servlet.service(req, resp);
+ }
+
+ public void registerMapping(String path, Servlet servlet) {
+ if (servlets.containsKey(path)) {
+ throw new IllegalStateException("Servlet already registered at path: " + path);
+ }
+ servlets.put(path, servlet);
+ }
+
+ public boolean isMappingRegistered(String mapping) {
+ return servlets.containsKey(mapping);
+
+ }
+
+ public Servlet unregisterMapping(String path) {
+ return servlets.remove(path);
+ }
+
+ public void addListener(RuntimeEventListener listener) {
+ throw new UnSupportedRuntimeException("Not Supported");
+
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+ throw new UnSupportedRuntimeException("Not Supported");
+
+ }
+
+ public void publish(Event event) {
+ if (null != registry && (event instanceof HttpSessionStart || event instanceof HttpSessionEnd)) {
+ ScopeContainer sc = registry.getScopeContainer(Scope.SESSION);
+ if (null != sc) {
+ sc.onEvent(event);
+
+ }
+ }
+ if (null != workContext) {
+ if (event instanceof HttpRequestStart) {
+ Object key = ((HttpRequestStart) event).getId();
+ if (null != key) {
+ workContext.setIdentifier(Scope.SESSION, ((HttpRequestStart) event).getId());
+ } else { // new request with no session.
+ workContext.clearIdentifier(Scope.SESSION);
+ }
+ } else if (event instanceof HttpRequestEnded) {
+ workContext.clearIdentifier(Scope.SESSION);
+
+ }
+
+ }
+
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+ throw new UnSupportedRuntimeException("Not Supported");
+
+ }
+
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherInitException.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherInitException.java
new file mode 100644
index 0000000000..0b47744e5f
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/ServletLauncherInitException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Thrown when an error is encountered booting the runtme in a web app environment
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServletLauncherInitException extends TuscanyRuntimeException {
+
+ public ServletLauncherInitException() {
+ }
+
+ public ServletLauncherInitException(String message) {
+ super(message);
+ }
+
+ public ServletLauncherInitException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ServletLauncherInitException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServletLauncherInitException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/UnSupportedRuntimeException.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/UnSupportedRuntimeException.java
new file mode 100644
index 0000000000..9cfa7345d6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/UnSupportedRuntimeException.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Thrown when an error is encountered booting the runtme in a web app environment
+ *
+ * @version $Rev: 439728 $ $Date: 2006-09-03 02:02:44 -0400 (Sun, 03 Sep 2006) $
+ */
+public class UnSupportedRuntimeException extends TuscanyRuntimeException {
+
+ public UnSupportedRuntimeException() {
+ }
+
+ public UnSupportedRuntimeException(String message) {
+ super(message);
+ }
+
+ public UnSupportedRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnSupportedRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebResourceScanExtender.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebResourceScanExtender.java
new file mode 100644
index 0000000000..41069b574b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebResourceScanExtender.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
+import javax.servlet.ServletContext;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.core.services.extension.AbstractExtensionDeployer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class WebResourceScanExtender extends AbstractExtensionDeployer {
+ private final WebappRuntimeInfo runtimeInfo;
+ private final String path;
+
+ public WebResourceScanExtender(@Reference WebappRuntimeInfo runtimeInfo,
+ @Property(name = "path")String path) {
+ this.runtimeInfo = runtimeInfo;
+ this.path = path;
+ }
+
+ @Init
+ public void init() {
+ ServletContext servletContext = runtimeInfo.getServletContext();
+ Set extensions = servletContext.getResourcePaths(path);
+ if (extensions == null || extensions.isEmpty()) {
+ // no extensions in this webapp
+ return;
+ }
+
+ for (Object e : extensions) {
+ String extensionPath = (String) e;
+ URL extension;
+ try {
+ extension = servletContext.getResource(extensionPath);
+ } catch (MalformedURLException e1) {
+ // web container should return an invalid URL for a path it gave us
+ throw new AssertionError();
+ }
+
+ String name = extensionPath.substring(path.length());
+ if (name.charAt(name.length() - 1) == '/') {
+ // TODO support exploded extensions
+ continue;
+ }
+ if (name.charAt(0) == '.') {
+ // hidden file
+ continue;
+ }
+
+ int lastDot = name.lastIndexOf('.');
+ if (lastDot != -1) {
+ name = name.substring(0, lastDot);
+ }
+ deployExtension(name, extension);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
new file mode 100644
index 0000000000..8453f5c934
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.servlet.ServletRequestInjector;
+import org.apache.tuscany.runtime.webapp.implementation.webapp.WebappComponent;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.GroupInitializationException;
+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;
+
+/**
+ * Bootstrapper for the Tuscany runtime in a web application host. This listener manages one runtime per servlet
+ * context; the lifecycle of that runtime corresponds to the the lifecycle of the associated servlet context.
+ * <p/>
+ * The bootstrapper launches the runtime, booting system extensions and applications, according to the servlet
+ * parameters defined in {@link Constants}. When the runtime is instantiated, it is placed in the servlet context with
+ * the attribute {@link Constants#RUNTIME_PARAM}. The runtime implements {@link WebappRuntime} so that filters and
+ * servlets loaded in the parent web app classloader may pass events and requests to it.
+ * <p/>
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public class WebappRuntimeImpl extends AbstractRuntime<WebappRuntimeInfo> implements WebappRuntime {
+ private ServletContext servletContext;
+
+ private ServletRequestInjector requestInjector;
+
+ public WebappRuntimeImpl() {
+ super(WebappRuntimeInfo.class);
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+/*
+ public void initialize() throws InitializationException {
+ super.initialize();
+
+ try {
+ SCAObject host = getTuscanySystem().getSystemChild("servletHost");
+ if (!(host instanceof AtomicComponent)) {
+ throw new InitializationException("Servlet host must be an atomic component");
+ }
+ requestInjector = (ServletRequestInjector) ((AtomicComponent) host).getTargetInstance();
+
+ if (getApplicationScdl() == null) {
+ throw new TuscanyInitException("Could not find application SCDL");
+ }
+ getRuntime().getRootComponent().start();
+ application = deployApplicationScdl(getDeployer(),
+ getRuntime().getRootComponent(),
+ getApplicationName(),
+ getApplicationScdl(),
+ getHostClassLoader());
+ application.start();
+ CompositeComponent current = application;
+ String path = servletContext.getInitParameter(Constants.CURRENT_COMPOSITE_PATH_PARAM);
+ if (path != null) {
+ StringTokenizer tokenizer = new StringTokenizer(path, "/");
+ while (tokenizer.hasMoreTokens()) {
+ SCAObject o = current.getChild(tokenizer.nextToken());
+ if (!(o instanceof CompositeComponent)) {
+ throw new ServletLauncherInitException("Invalid context path", path);
+ }
+ current = (CompositeComponent) o;
+ }
+ }
+ context = new CompositeContextImpl(current, getWireService());
+ servletContext.setAttribute(Constants.CONTEXT_ATTRIBUTE, context);
+ } catch (Exception e) {
+ throw new ServletLauncherInitException(e);
+ }
+ }
+*/
+
+ @Deprecated
+ public void deploy(URI compositeId, URL applicationScdl, URI componentId) throws InitializationException {
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(applicationScdl);
+ impl.setClassLoader(getHostClassLoader());
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(compositeId, impl);
+ Collection<Component> components;
+ try {
+ components = getDeployer().deploy(null, definition);
+ } catch (LoaderException e) {
+ throw new InitializationException(e);
+ } catch (BuilderException e) {
+ throw new InitializationException(e);
+ } catch (ComponentException e) {
+ throw new InitializationException(e);
+ } catch (ResolutionException e) {
+ throw new InitializationException(e);
+ }
+ for (Component component : components) {
+ component.start();
+ }
+
+ try {
+ ScopeRegistry scopeRegistry = getScopeRegistry();
+ ScopeContainer<URI> container = scopeRegistry.getScopeContainer(Scope.COMPOSITE);
+ container.startContext(compositeId, compositeId);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, compositeId);
+ } catch (GroupInitializationException e) {
+ throw new InitializationException(e);
+ }
+
+ componentId = URI.create(compositeId.toString()+'/').resolve(componentId);
+ Component component = getComponentManager().getComponent(componentId);
+ if (component == null) {
+ throw new TuscanyInitException("No component found with id " + componentId, componentId.toString());
+ }
+ if (component instanceof WebappComponent) {
+ WebappComponent webapp = (WebappComponent) component;
+ webapp.bind(getServletContext());
+ }
+ }
+
+ public ServletRequestInjector getRequestInjector() {
+ return requestInjector;
+ }
+
+ public void sessionCreated(HttpSessionEvent event) {
+/*
+ HttpSessionStart startSession = new HttpSessionStart(this, event.getSession().getId());
+ application.publish(startSession);
+ ((EventPublisher) requestInjector).publish(startSession);
+*/
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event) {
+/*
+ HttpSessionEnd endSession = new HttpSessionEnd(this, event.getSession().getId());
+ application.publish(endSession);
+ ((EventPublisher) requestInjector).publish(endSession);
+*/
+ }
+
+ public void httpRequestStarted(HttpServletRequest request) {
+/*
+ HttpSession session = request.getSession(false);
+ Object sessionId = session == null ? new LazyHTTPSessionId(request) : session.getId();
+ HttpRequestStart httpRequestStart = new HttpRequestStart(this, sessionId);
+ application.publish(httpRequestStart);
+ ((EventPublisher) requestInjector).publish(httpRequestStart);
+*/
+ }
+
+ public void httpRequestEnded(Object sessionid) {
+/*
+ HttpRequestEnded httpRequestEnded = new HttpRequestEnded(this, sessionid);
+ application.publish(httpRequestEnded);
+ ((EventPublisher) requestInjector).publish(httpRequestEnded);
+*/
+ }
+
+
+ public void startRequest() {
+/*
+ application.publish(new RequestStart(this));
+*/
+ }
+
+ public void stopRequest() {
+/*
+ application.publish(new RequestEnd(this));
+*/
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappBuilder.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappBuilder.java
new file mode 100644
index 0000000000..ea9c44c48b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappBuilder.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp.implementation.webapp;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectFactory;
+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.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappBuilder extends ComponentBuilderExtension<WebappImplementation> {
+ protected Class<WebappImplementation> getImplementationType() {
+ return WebappImplementation.class;
+ }
+
+ public Component build(ComponentDefinition<WebappImplementation> definition, DeploymentContext context)
+ throws BuilderException {
+
+ URI uri = definition.getUri();
+ WebappComponentType componentType = definition.getImplementation().getComponentType();
+
+ Map<String, ObjectFactory<?>> attributes = new HashMap<String, ObjectFactory<?>>();
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ attributes.put(property.getName(), factory);
+ }
+ }
+
+ Map<String, Class<?>> referenceTypes = new HashMap<String, Class<?>>();
+ for (ReferenceDefinition referenceDefinition : componentType.getReferences().values()) {
+ String name = referenceDefinition.getUri().getFragment();
+ Class<?> type = referenceDefinition.getServiceContract().getInterfaceClass();
+ referenceTypes.put(name, type);
+ }
+
+ return new WebappComponent(uri, proxyService, workContext, context.getGroupId(), attributes, referenceTypes);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponent.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponent.java
new file mode 100644
index 0000000000..f4b3276c6b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponent.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp.implementation.webapp;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.servlet.ServletContext;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+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.component.WorkContext;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+
+import org.apache.tuscany.core.component.ComponentContextImpl;
+import org.apache.tuscany.core.component.ComponentContextProvider;
+import org.apache.tuscany.core.component.ServiceReferenceImpl;
+import org.apache.tuscany.core.wire.WireObjectFactory;
+import org.apache.tuscany.runtime.webapp.Constants;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappComponent extends AtomicComponentExtension implements ComponentContextProvider {
+ private final Map<String, ObjectFactory<?>> propertyFactories;
+ private final Map<String, Class<?>> referenceTypes;
+ private final Map<String, Wire> referenceFactories;
+ private final ComponentContext context;
+
+ public WebappComponent(URI name,
+ ProxyService proxyService,
+ WorkContext workContext,
+ URI groupId,
+ Map<String, ObjectFactory<?>> attributes,
+ Map<String, Class<?>> referenceTypes) {
+ super(name, proxyService, workContext, groupId, 0, 0, 0);
+ this.propertyFactories = attributes;
+ this.referenceTypes = referenceTypes;
+ referenceFactories = new ConcurrentHashMap<String, Wire>(referenceTypes.size());
+ context = new ComponentContextImpl(this);
+ }
+
+ public List<Wire> getWires(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWire(Wire wire) {
+ String name = wire.getSourceUri().getFragment();
+ referenceFactories.put(name, wire);
+ }
+
+ public void attachWires(List<Wire> wires) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {
+ return new WireObjectFactory<B>(interfaze, wire, proxyService);
+ }
+
+ public void bind(ServletContext servletContext) {
+ servletContext.setAttribute(Constants.CONTEXT_ATTRIBUTE, getComponentContext());
+ for (Map.Entry<String, ObjectFactory<?>> entry : propertyFactories.entrySet()) {
+ servletContext.setAttribute(entry.getKey(), entry.getValue().getInstance());
+ }
+ for (Map.Entry<String, Wire> entry : referenceFactories.entrySet()) {
+ String name = entry.getKey();
+ Wire wire = entry.getValue();
+ Class<?> type = referenceTypes.get(name);
+ ObjectFactory<?> factory = createWireFactory(type, wire);
+ servletContext.setAttribute(name, factory.getInstance());
+ }
+ }
+
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ComponentContext getComponentContext() {
+ return context;
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ ObjectFactory<?> factory = propertyFactories.get(propertyName);
+ if (factory != null) {
+ return type.cast(factory.getInstance());
+ } else {
+ return null;
+ }
+
+ }
+
+ public <B> B getService(Class<B> type, String name) {
+ Wire wire = referenceFactories.get(name);
+ if (wire == null) {
+ return null;
+ }
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return factory.getInstance();
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> type, String name) {
+ Wire wire = referenceFactories.get(name);
+ if (wire == null) {
+ return null;
+ }
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return new ServiceReferenceImpl<B>(type, factory);
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) {
+ return (R) proxyService.cast(target);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentType.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentType.java
new file mode 100644
index 0000000000..89b3f8283a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp.implementation.webapp;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> {
+ public Scope getImplementationScope() {
+ return Scope.COMPOSITE;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentTypeLoader.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentTypeLoader.java
new file mode 100644
index 0000000000..56bd65169c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappComponentTypeLoader.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp.implementation.webapp;
+
+import org.osoa.sca.annotations.Reference;
+
+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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappComponentTypeLoader extends ComponentTypeLoaderExtension<WebappImplementation> {
+
+ public WebappComponentTypeLoader(@Reference LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ protected Class<WebappImplementation> getImplementationClass() {
+ return WebappImplementation.class;
+ }
+
+ public void load(
+ WebappImplementation implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappImplementation.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappImplementation.java
new file mode 100644
index 0000000000..03a8a7d5be
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappImplementation.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp.implementation.webapp;
+
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappImplementation extends Implementation<WebappComponentType> {
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappLoader.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappLoader.java
new file mode 100644
index 0000000000..7794979a03
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/implementation/webapp/WebappLoader.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.webapp.implementation.webapp;
+
+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 org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.InterfaceJavaIntrospector;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.IllegalSCDLNameException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappLoader extends LoaderExtension<WebappImplementation> {
+ private static final QName WEBAPP = new QName("http://tuscany.apache.org/xmlns/sca/2.0-alpha", "webapp");
+
+ private final InterfaceJavaIntrospector introspector;
+
+ public WebappLoader(@Reference LoaderRegistry registry,
+ @Reference InterfaceJavaIntrospector introspector) {
+ super(registry);
+ this.introspector = introspector;
+ }
+
+ public QName getXMLType() {
+ return WEBAPP;
+ }
+
+ public WebappImplementation load(
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ WebappComponentType componentType = new WebappComponentType();
+ WebappImplementation impl = new WebappImplementation();
+ impl.setComponentType(componentType);
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if ("reference".equals(qname.getLocalPart())) {
+ defineReference(componentType, reader, deploymentContext);
+ } else {
+ throw new UnrecognizedElementException(qname);
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ return impl;
+ }
+ }
+ }
+
+ protected void defineReference(WebappComponentType componentType,
+ XMLStreamReader reader,
+ DeploymentContext context) throws LoaderException {
+ String name = reader.getAttributeValue(null, "name");
+ URI referenceURI;
+ try {
+ referenceURI = new URI('#' + name);
+ } catch (URISyntaxException e) {
+ throw new IllegalSCDLNameException(e);
+ }
+
+ String className = reader.getAttributeValue(null, "interface");
+ if (className == null) {
+ className = reader.getAttributeValue(null, "class");
+ }
+
+ Class<?> referenceType;
+ try {
+ referenceType = context.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException(className, e);
+ }
+
+ ServiceContract serviceContract;
+ try {
+ serviceContract = introspector.introspect(referenceType);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException("Invalid service contract", name, e);
+ }
+
+ ReferenceDefinition definition = new ReferenceDefinition(referenceURI, serviceContract);
+ componentType.add(definition);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/resources/META-INF/tuscany/webapp.scdl b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/resources/META-INF/tuscany/webapp.scdl
new file mode 100644
index 0000000000..35ee968b32
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/main/resources/META-INF/tuscany/webapp.scdl
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.runtime.webapp.System"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="introspector">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="interceptorBuilderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.interceptor.InterceptorBuilderRegistryImpl"/>
+ </component>
+
+ <component name="wireAttacherRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.physical.WireAttacherRegistryImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+
+<!--
+ <component name="scope.httpsession">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.HttpSessionScopeContainer"/>
+ </component>
+-->
+
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.launcher.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.launcher.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.launcher.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.launcher.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.launcher.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.launcher.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- Data Binding -->
+ <include name="org.apache.tuscany.launcher.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <!-- Web app ServletHost -->
+ <component name="servletHost">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.ServletHostImpl"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">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/</property>
+ </component>
+
+ <component name="extender" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.WebResourceScanExtender"/>
+ <property name="path">/WEB-INF/tuscany/extensions/</property>
+ </component>
+
+ <component name="wireLoader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.WireLoader"/>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <!-- webapp component implementation -->
+ <component name="webappLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.implementation.webapp.WebappLoader"/>
+ </component>
+
+ <component name="webappComponentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.implementation.webapp.WebappComponentTypeLoader"/>
+ </component>
+
+ <component name="webappComponentTypeBuilder">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.implementation.webapp.WebappBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/Foo.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/Foo.java
new file mode 100644
index 0000000000..75b49de188
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/Foo.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Foo {
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/FooImpl.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/FooImpl.java
new file mode 100644
index 0000000000..dd938f2a58
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/FooImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FooImpl implements Foo {
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionIdTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionIdTestCase.java
new file mode 100644
index 0000000000..f41fa2361b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/LazyHTTPSessionIdTestCase.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import junit.framework.TestCase;
+
+public class LazyHTTPSessionIdTestCase extends TestCase {
+
+ public void testGetIdentifier() {
+ HttpSession id = createMock(HttpSession.class);
+
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getSession(true)).andReturn(id);
+ replay(request);
+
+ LazyHTTPSessionId lazyHTTPSessionId = new LazyHTTPSessionId(request);
+ assertEquals(id, lazyHTTPSessionId.getIdentifier());
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/ServletHostTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/ServletHostTestCase.java
new file mode 100644
index 0000000000..3d979e8f46
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/ServletHostTestCase.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.verify;
+
+import javax.servlet.Servlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServletHostTestCase extends TestCase {
+
+ public void testDispatch() throws Exception {
+ HttpServletRequest req = createMock(HttpServletRequest.class);
+ expect(req.getPathInfo()).andReturn("foo");
+ replay(req);
+ HttpServletResponse res = createMock(HttpServletResponse.class);
+ Servlet servlet = createMock(Servlet.class);
+ servlet.service(req, res);
+ EasyMock.expectLastCall();
+ replay(servlet);
+ ServletHostImpl host = new ServletHostImpl();
+ host.registerMapping("foo", servlet);
+ host.service(req, res);
+ verify(servlet);
+ }
+
+ public void testDuplicateRegistration() throws Exception {
+ Servlet servlet = createMock(Servlet.class);
+ ServletHostImpl host = new ServletHostImpl();
+ host.registerMapping("foo", servlet);
+ assertEquals(true, host.isMappingRegistered("foo"));
+ assertEquals(false, host.isMappingRegistered("bar"));
+ try {
+ host.registerMapping("foo", servlet);
+ fail();
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ }
+
+ public void testUnregister() throws Exception {
+ HttpServletRequest req = createMock(HttpServletRequest.class);
+ expect(req.getPathInfo()).andReturn("foo");
+ replay(req);
+ HttpServletResponse res = createMock(HttpServletResponse.class);
+ Servlet servlet = createMock(Servlet.class);
+ replay(servlet);
+ ServletHostImpl host = new ServletHostImpl();
+ host.registerMapping("foo", servlet);
+ Servlet unregedServlet = host.unregisterMapping("foo");
+ assertEquals(unregedServlet, servlet);
+ try {
+ host.service(req, res);
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ verify(servlet);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java
new file mode 100644
index 0000000000..c076fb73cf
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebappRuntimeImplTestCase extends TestCase {
+ private URL applicationScdl;
+ private URL systemScdl;
+ private WebappRuntimeImpl runtime;
+ private ServletContext context;
+
+ /**
+ * Verifies the web app host is configured properly to perform a basic boot
+ */
+ public void testBootWithDefaults() throws Exception {
+ expect(context.getResourcePaths("/WEB-INF/tuscany/extensions/")).andReturn(null);
+ replay(context);
+ runtime.initialize();
+ verify(context);
+ }
+
+/*
+ public void testLazyHttpSessionId() throws Exception {
+ expect(context.getResourcePaths("/WEB-INF/tuscany/extensions/")).andReturn(null);
+ replay(context);
+ runtime.initialize();
+ verify(context);
+
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getSession(true)).andReturn(null);
+ expect(request.getSession(false)).andReturn(null);
+ replay(request);
+
+ runtime.httpRequestStarted(request);
+
+ ServletRequestInjector injector = runtime.getRequestInjector();
+ class WorkContextAccessor extends ServletHostImpl {
+ ServletHostImpl servletHostImpl;
+ WorkContextAccessor(ServletHostImpl servletHostImpl){
+ this.servletHostImpl = servletHostImpl;
+ }
+ WorkContext getWorkContext() {
+ return servletHostImpl.workContext;
+ }
+ }
+ WorkContext workContext = new WorkContextAccessor((ServletHostImpl)injector).getWorkContext();
+ workContext.getIdentifier(Scope.SESSION);
+ verify(request);
+ }
+*/
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ systemScdl = getClass().getResource("/META-INF/tuscany/webapp.scdl");
+ applicationScdl = getClass().getResource("/testapp.scdl");
+ context = createMock(ServletContext.class);
+
+ runtime = new WebappRuntimeImpl();
+ runtime.setRuntimeInfo(new WebappRuntimeInfoImpl(context, null, false));
+ runtime.setMonitorFactory(new NullMonitorFactory());
+ runtime.setHostClassLoader(getClass().getClassLoader());
+ runtime.setServletContext(context);
+ runtime.setSystemScdl(systemScdl);
+ runtime.setApplicationName("foo");
+ runtime.setApplicationScdl(applicationScdl);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/resources/testapp.scdl b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/resources/testapp.scdl
new file mode 100644
index 0000000000..9b5bda7fb6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-webapp/webapp-host/src/test/resources/testapp.scdl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="testapp">
+
+ <component name="component">
+ <implementation.java class="org.apache.tuscany.runtime.webapp.FooImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/topology-xml/DISCLAIMER b/sandbox/old/contrib/topology-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/old/contrib/topology-xml/LICENSE b/sandbox/old/contrib/topology-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ 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.
+
+
+
diff --git a/sandbox/old/contrib/topology-xml/NOTICE b/sandbox/old/contrib/topology-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/topology-xml/pom.xml b/sandbox/old/contrib/topology-xml/pom.xml
new file mode 100644
index 0000000000..7d14387afb
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-topology-xml</artifactId>
+ <name>Apache Tuscany SCA Topology XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-topology</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/BaseTopologyArtifactProcessor.java b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/BaseTopologyArtifactProcessor.java
new file mode 100644
index 0000000000..a72b20cb8e
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/BaseTopologyArtifactProcessor.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.topology.TopologyFactory;
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseTopologyArtifactProcessor extends BaseStAXArtifactProcessor implements Constants {
+
+ protected TopologyFactory topologyFactory;
+ protected AssemblyFactory assemblyFactory;
+ protected StAXArtifactProcessor<Object> extensionProcessor;
+
+ private static final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ static {
+ domFactory.setNamespaceAware(true);
+ }
+
+ /**
+ * Construct a new BaseArtifactProcessor.
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseTopologyArtifactProcessor(TopologyFactory topologyFactory, AssemblyFactory assemblyFactory, StAXArtifactProcessor extensionProcessor) {
+ this.topologyFactory = topologyFactory;
+ this.assemblyFactory = assemblyFactory;
+ this.extensionProcessor = extensionProcessor;
+ }
+
+ /**
+ * Start an element.
+ * @param writer
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writeStart(writer, TUSCANY_TOPOLOGY_10_NS, name, attrs);
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writeStartDocument(writer, TUSCANY_TOPOLOGY_10_NS, name, attrs);
+ }
+
+ /**
+ * Resolve an implementation.
+ * @param implementation
+ * @param resolver
+ * @return
+ * @throws ContributionResolveException
+ */
+ protected Implementation resolveImplementation(Implementation implementation, ModelResolver resolver) throws ContributionResolveException {
+ if (implementation != null) {
+ if (implementation.isUnresolved()) {
+ implementation = resolver.resolveModel(Implementation.class, implementation);
+
+ // Lazily resolve implementations
+ if (implementation.isUnresolved()) {
+ extensionProcessor.resolve(implementation, resolver);
+ if (!implementation.isUnresolved()) {
+ resolver.addModel(implementation);
+ }
+ }
+ }
+ }
+ return implementation;
+ }
+
+ /**
+ * Resolve interface, callback interface and bindings on a list of contracts.
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends Contract> void resolveContracts(List<C> contracts, ModelResolver resolver) throws ContributionResolveException {
+ for (Contract contract: contracts) {
+
+ // Resolve the interface contract
+ InterfaceContract interfaceContract = contract.getInterfaceContract();
+ if (interfaceContract != null) {
+ extensionProcessor.resolve(interfaceContract, resolver);
+ }
+
+ // Resolve bindings
+ for (int i = 0, n = contract.getBindings().size(); i < n; i++) {
+ Binding binding = contract.getBindings().get(i);
+ extensionProcessor.resolve(binding, resolver);
+ }
+
+ // Resolve callback bindings
+ if (contract.getCallback() != null) {
+ for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
+ Binding binding = contract.getCallback().getBindings().get(i);
+ extensionProcessor.resolve(binding, resolver);
+ }
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/Constants.java b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/Constants.java
new file mode 100644
index 0000000000..fc450db3b5
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/Constants.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants used in Tuscany Topology XML files.
+ */
+public interface Constants {
+
+ String TUSCANY_TOPOLOGY_10_NS = "http://www.apache.org/tuscany/topology/1.0";
+
+ String RUNTIME = "runtime";
+ QName RUNTIME_QNAME = new QName(TUSCANY_TOPOLOGY_10_NS, RUNTIME);
+ String NODE = "node";
+ QName NODE_QNAME = new QName(TUSCANY_TOPOLOGY_10_NS, NODE);
+ String DOMAIN = "domain";
+ QName DOMAIN_QNAME = new QName(TUSCANY_TOPOLOGY_10_NS, DOMAIN);
+ String SCHEME = "scheme";
+ QName SCHEME_QNAME = new QName(TUSCANY_TOPOLOGY_10_NS, SCHEME);
+ String COMPONENT = "component";
+ QName COMPONENT_QNAME = new QName(TUSCANY_TOPOLOGY_10_NS, COMPONENT);
+
+
+ String TARGET_NAMESPACE = "targetNamespace";
+ String NAME = "name";
+ String BASE_URL = "baseURL";
+ String DEFAULT_DOMAIN = "nodomain";
+
+}
diff --git a/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyDocumentProcessor.java b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyDocumentProcessor.java
new file mode 100644
index 0000000000..11489419a4
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyDocumentProcessor.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.topology.Runtime;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyDocumentProcessor extends BaseTopologyArtifactProcessor implements URLArtifactProcessor<Runtime> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public TopologyDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public Runtime read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ reader.nextTag();
+ Runtime node = (Runtime)extensionProcessor.read(reader);
+ return node;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(Runtime node, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(node, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".topology";
+ }
+
+ public Class<Runtime> getModelType() {
+ return Runtime.class;
+ }
+}
diff --git a/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyProcessor.java b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyProcessor.java
new file mode 100644
index 0000000000..25f62bf4c4
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/main/java/org/apache/tuscany/sca/topology/xml/TopologyProcessor.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Runtime;
+import org.apache.tuscany.sca.topology.Scheme;
+import org.apache.tuscany.sca.topology.Component;
+import org.apache.tuscany.sca.topology.TopologyFactory;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyProcessor extends BaseTopologyArtifactProcessor implements StAXArtifactProcessor<Runtime> {
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public TopologyProcessor(TopologyFactory topologyFactory,
+ AssemblyFactory assemblyFactory,
+ StAXArtifactProcessor extensionProcessor) {
+ super(topologyFactory, assemblyFactory, extensionProcessor);
+ }
+
+ public Runtime read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ QName name = null;
+ Runtime runtime = null;
+ Node node = null;
+ String domainName = DEFAULT_DOMAIN;
+
+ // Read the composite document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (RUNTIME_QNAME.equals(name)) {
+ // Read a <runtime>
+ runtime = topologyFactory.createRuntime();
+ } else if (NODE_QNAME.equals(name)) {
+ // Read a <node>
+ node = topologyFactory.createNode();
+ node.setName(getString(reader, NAME));
+
+ // add node to runtime
+ runtime.getNodes().add(node);
+
+ // reset domain name to the default
+ domainName = DEFAULT_DOMAIN;
+ } else if (DOMAIN_QNAME.equals(name)) {
+ // Read a <domain>
+ domainName = getString(reader, NAME);
+ } else if (SCHEME_QNAME.equals(name)) {
+ // Read a <scheme>
+ Scheme scheme = topologyFactory.createScheme();
+ scheme.setName(getString(reader, NAME));
+ scheme.setBaseURL(getString(reader, BASE_URL));
+
+ scheme.setDomainName(domainName);
+
+ // Add scheme to the node
+ node.getSchemes(domainName).add(scheme);
+ } else if (COMPONENT_QNAME.equals(name)) {
+ // Read a <component>
+ Component component = topologyFactory.createComponent();
+ component.setName(getString(reader, NAME));
+
+ component.setDomainName(domainName);
+
+ // Add scheme to the node
+ node.getComponents(domainName).add(component);
+
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+
+ if (extension != null) {
+ // no extensions are supported
+ }
+ }
+
+ case END_ELEMENT:
+ name = reader.getName();
+ // Clear current state when reading reaching end element
+ }
+
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return runtime;
+ }
+
+
+ public void write(Runtime runtime, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writeStartDocument(writer, RUNTIME);
+
+ // TODO - write out the scheme definitions
+
+ for (Node node : runtime.getNodes()) {
+ writeStart(writer, NODE, new XAttr(NAME, node.getName()));
+
+ for (String domainName : node.getDomainNames()) {
+
+ writeStart(writer, DOMAIN, new XAttr(NAME, domainName));
+
+ for (Scheme scheme: node.getSchemes(domainName)) {
+ writeStart(writer, SCHEME, new XAttr(NAME, scheme.getName()), new XAttr(BASE_URL, scheme.getBaseURL()));
+ writeEnd(writer);
+ }
+
+ for (Component component: node.getComponents(domainName)) {
+ writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()));
+ writeEnd(writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Runtime runtime, ModelResolver resolver) throws ContributionResolveException {
+ // no resolution steps defined
+ }
+
+ public QName getArtifactType() {
+ return RUNTIME_QNAME;
+ }
+
+ public Class<Runtime> getModelType() {
+ return Runtime.class;
+ }
+}
diff --git a/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/ReadDocumentTestCase.java b/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..ad7b2c5d37
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/ReadDocumentTestCase.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.topology.Component;
+import org.apache.tuscany.sca.topology.DefaultTopologyFactory;
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Runtime;
+import org.apache.tuscany.sca.topology.Scheme;
+import org.apache.tuscany.sca.topology.TopologyFactory;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private ExtensibleURLArtifactProcessor documentProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ TopologyFactory topologyFactory = new DefaultTopologyFactory();
+
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new TopologyProcessor(topologyFactory, factory, staxProcessor));
+
+ // Create document processors
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new TopologyDocumentProcessor(staxProcessor, inputFactory));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ documentProcessor = null;
+ }
+
+ public void testReadTopology() throws Exception {
+ URL url = getClass().getResource("runtime.topology");
+ Runtime runtime = (Runtime)documentProcessor.read(null, null, url);
+ assertNotNull(runtime);
+
+ Node node0 = runtime.getNodes().get(0);
+ Scheme scheme0 = node0.getSchemes("nodomain").get(0);
+ assertEquals(scheme0.getName(), "http");
+
+ Node node1 = runtime.getNodes().get(1);
+ Component component0 = node1.getComponents("domainA").get(0);
+ assertEquals(component0.getName(), "AddServiceComponent");
+ }
+}
diff --git a/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/TestModelResolver.java b/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/TestModelResolver.java
new file mode 100644
index 0000000000..b079958f8a
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/test/java/org/apache/tuscany/sca/topology/xml/TestModelResolver.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/sandbox/old/contrib/topology-xml/src/test/resources/org/apache/tuscany/sca/topology/xml/runtime.topology b/sandbox/old/contrib/topology-xml/src/test/resources/org/apache/tuscany/sca/topology/xml/runtime.topology
new file mode 100644
index 0000000000..f1c625052b
--- /dev/null
+++ b/sandbox/old/contrib/topology-xml/src/test/resources/org/apache/tuscany/sca/topology/xml/runtime.topology
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<runtime xmlns="http://www.apache.org/tuscany/topology/1.0">
+ <node name="nodeA">
+ <scheme name="http" baseURL="http://localhost:80" />
+ <scheme name="https" baseURL="https://localhost:443" />
+ <component name="CalculatorServiceComponent" />
+ </node>
+ <node name="nodeB">
+ <domain name="domainA">
+ <scheme name="http" baseURL="http://localhost:81" />
+ <scheme name="https" baseURL="https://localhost:444" />
+ <component name="AddServiceComponent" />
+ </domain>
+ </node>
+</runtime>
+
diff --git a/sandbox/old/contrib/topology/DISCLAIMER b/sandbox/old/contrib/topology/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sandbox/old/contrib/topology/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/sandbox/old/contrib/topology/LICENSE b/sandbox/old/contrib/topology/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sandbox/old/contrib/topology/LICENSE
@@ -0,0 +1,205 @@
+
+ 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.
+
+
+
diff --git a/sandbox/old/contrib/topology/NOTICE b/sandbox/old/contrib/topology/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sandbox/old/contrib/topology/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/topology/pom.xml b/sandbox/old/contrib/topology/pom.xml
new file mode 100644
index 0000000000..3183f6cbd0
--- /dev/null
+++ b/sandbox/old/contrib/topology/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-topology</artifactId>
+ <name>Apache Tuscany SCA Topology Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java
new file mode 100644
index 0000000000..512fa19645
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+/**
+ * Represents an SCA component and is used to represent which components
+ * will run on a node
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Component {
+
+ /**
+ * Get the compoent name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the compoent name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ * Not sure in this case whether the domain name should
+ * be part of the component name but am keeping it
+ * separate for now
+ *
+ * @return
+ */
+ public String getDomainName();
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ * Not sure in this case whether the domain name should
+ * be part of the component name but am keeping it
+ * separate for now
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName);
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java
new file mode 100644
index 0000000000..ddeeac9a93
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+import org.apache.tuscany.sca.topology.impl.TopologyFactoryImpl;
+
+/**
+ * A default factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultTopologyFactory extends TopologyFactoryImpl implements TopologyFactory {
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java
new file mode 100644
index 0000000000..a44e998e43
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Represents an SCA node implementation. An SCA node is a running instance
+ * of a program able to run SCA assemblies. A distributes runtime contains
+ * main nodes
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Node {
+
+ /**
+ * Get the node name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the node name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Get domain names
+ *
+ * @return
+ */
+ public Set<String> getDomainNames();
+
+ /**
+ * Return the Scheme/base URL pairs that this node uses for the
+ * specified domain.
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Scheme> getSchemes(String domainName);
+
+ /**
+ * Return the list of components that this node will run for the
+ * specified domain
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Component> getComponents(String domainName);
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java
new file mode 100644
index 0000000000..7775a3878f
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+import java.util.List;
+
+
+/**
+ * Represents an SCA runtime.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Runtime {
+
+ /**
+ * Returns the list of nodes that form this runtime
+ *
+ * @return
+ */
+ public List<Node> getNodes();
+
+ /**
+ * Get a node by node name
+ *
+ * @param nodeName the name of the node to return
+ * @return the node
+ */
+ public Node getNode(String nodeName);
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java
new file mode 100644
index 0000000000..794e43e8a6
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+
+/**
+ * Represents an SCA scheme. This holds the base URL that a runtime node
+ * will use by default to expose services
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Scheme {
+
+ /**
+ * Get the scheme name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the scheme name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Get the scheme base URL
+ *
+ * @return
+ */
+ public String getBaseURL();
+
+ /**
+ * Set the scheme base URL
+ *
+ * @param name
+ */
+ public void setBaseURL(String urlString);
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ *
+ * @return
+ */
+ public String getDomainName();
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName);
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
new file mode 100644
index 0000000000..020b15ea17
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology;
+
+
+/**
+ * A factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TopologyFactory {
+
+
+ /**
+ * Creates a new runtime.
+ * @return
+ */
+ public Runtime createRuntime();
+
+ /**
+ * Creates a new node.
+ * @return
+ */
+ public Node createNode();
+
+ /**
+ * Creates a new scheme.
+ * @return
+ */
+ public Scheme createScheme();
+
+ /**
+ * Creates a new component.
+ * @return
+ */
+ public Component createComponent();
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java
new file mode 100644
index 0000000000..68364e3420
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.impl;
+
+import org.apache.tuscany.sca.topology.Component;
+
+/**
+ * Represents the scheme defintion for a domain.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl implements Component {
+
+ private String name;
+ private String domainName;
+
+ /**
+ * Get the component name
+ *
+ * @return
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Set the component name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the name of the domain that this component belongs to
+ *
+ * @return
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ * Set the name of the domain that this component belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java
new file mode 100644
index 0000000000..0200376caa
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Scheme;
+import org.apache.tuscany.sca.topology.Component;
+
+/**
+ * Represents an SCA node implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class NodeImpl implements Node {
+ private HashMap<String, DomainContainer> nodeDomain = new HashMap<String, DomainContainer>();
+ private String name;
+
+ public class DomainContainer {
+ private List<Scheme> schemes = new ArrayList<Scheme>();
+ private List<Component> components = new ArrayList<Component>();
+
+ public List<Scheme> getSchemes() {
+ return schemes;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+ }
+
+ /**
+ * Constructs a new node.
+ */
+ protected NodeImpl() {
+ }
+
+ /**
+ * Get the node name
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the node name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get domain names
+ *
+ * @return
+ */
+ public Set<String> getDomainNames() {
+ return nodeDomain.keySet();
+ }
+
+ /**
+ * Return the Scheme/base URL pairs that this node uses for the
+ * specified domain.
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Scheme> getSchemes(String domainName) {
+ DomainContainer container = nodeDomain.get(domainName);
+
+ if (container == null) {
+ container = new DomainContainer();
+ nodeDomain.put(domainName, container);
+ }
+ return container.getSchemes();
+ }
+
+ /**
+ * Return the list of components that this node will run for the
+ * specified domain
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Component> getComponents(String domainName) {
+ DomainContainer container = nodeDomain.get(domainName);
+
+ if (container == null) {
+ container = new DomainContainer();
+ nodeDomain.put(domainName, container);
+ }
+ return container.getComponents();
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java
new file mode 100644
index 0000000000..9a4568deee
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.topology.Runtime;
+import org.apache.tuscany.sca.topology.Node;
+
+/**
+ * Represents an SCA runtime.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeImpl implements Runtime {
+ private List<Node> nodes = new ArrayList<Node>();
+
+ public List<Node> getNodes() {
+ return nodes;
+ }
+
+ public Node getNode(String nodeName){
+ Node returnNode = null;
+
+ for(Node node : getNodes()){
+ if ( node.getName().equals(nodeName)){
+ returnNode = node;
+ break;
+ }
+ }
+
+ return returnNode;
+ }
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java
new file mode 100644
index 0000000000..ffd08cef92
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.impl;
+
+import org.apache.tuscany.sca.topology.Scheme;
+
+/**
+ * Represents the scheme defintion for a domain.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class SchemeImpl implements Scheme {
+
+ private String name;
+ private String baseURL;
+ private String domainName;
+
+ /**
+ * Get the scheme name
+ *
+ * @return
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Set the scheme name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the scheme base URL
+ *
+ * @return
+ */
+ public String getBaseURL() {
+ return baseURL;
+ }
+
+ /**
+ * Set the scheme base URL
+ *
+ * @param name
+ */
+ public void setBaseURL(String urlString) {
+ this.baseURL = urlString;
+ }
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ *
+ * @return
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+}
diff --git a/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
new file mode 100644
index 0000000000..793ed4a06d
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.topology.impl;
+
+import org.apache.tuscany.sca.topology.Component;
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Runtime;
+import org.apache.tuscany.sca.topology.Scheme;
+import org.apache.tuscany.sca.topology.TopologyFactory;
+
+/**
+ * A factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyFactoryImpl implements TopologyFactory {
+
+ public Runtime createRuntime() {
+ return new RuntimeImpl();
+ }
+
+ public Node createNode() {
+ return new NodeImpl();
+ }
+
+ public Scheme createScheme() {
+ return new SchemeImpl();
+ }
+
+ public Component createComponent() {
+ return new ComponentImpl();
+ }
+}
diff --git a/sandbox/old/contrib/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java b/sandbox/old/contrib/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
new file mode 100644
index 0000000000..0cf572ba57
--- /dev/null
+++ b/sandbox/old/contrib/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.topology;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test building of assembly model instances using the assembly factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyFactoryTestCase extends TestCase {
+
+ TopologyFactory topologyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ topologyFactory = new DefaultTopologyFactory();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ topologyFactory = null;
+ }
+
+ public void testCreateRuntime() {
+ Runtime runtime = topologyFactory.createRuntime();
+
+ List<Node> nodeList = runtime.getNodes();
+ assertNotNull(nodeList);
+ }
+
+ public void testCreateNode() {
+ Node node = topologyFactory.createNode();
+
+ node.setName("nodeA");
+ assertEquals(node.getName(), "nodeA");
+
+ List<Scheme> schemeList = node.getSchemes("domainA");
+ assertNotNull(schemeList);
+
+ List<Component> componentList = node.getComponents("domainA");
+ assertNotNull(componentList);
+ }
+
+ public void testCreateScheme() {
+ Scheme scheme = topologyFactory.createScheme();
+
+ scheme.setName("http");
+ assertEquals(scheme.getName(), "http");
+
+ scheme.setBaseURL("http://localhost:8080");
+ assertEquals(scheme.getBaseURL(), "http://localhost:8080");
+
+ scheme.setDomainName("domainA");
+ assertEquals(scheme.getDomainName(), "domainA");
+
+ Node node = topologyFactory.createNode();
+ List<Scheme> schemeList = node.getSchemes("domainA");
+ schemeList.add(scheme);
+ List<Scheme> schemeList1 = node.getSchemes("domainA");
+ Scheme scheme1 = schemeList1.get(0);
+
+ assertEquals(scheme1.getName(), "http");
+
+ }
+
+ public void testCreateComponent() {
+ Component component = topologyFactory.createComponent();
+
+ component.setName("componentA");
+ assertEquals(component.getName(), "componentA");
+
+ component.setDomainName("domainA");
+ assertEquals(component.getDomainName(), "domainA");
+
+ Node node = topologyFactory.createNode();
+ List<Component> componentList = node.getComponents("domainA");
+ componentList.add(component);
+ List<Component> componentList1 = node.getComponents("domainA");
+ Component component1 = componentList1.get(0);
+
+ assertEquals(component1.getName(), "componentA");
+ }
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/.ruleset b/sandbox/old/contrib/transaction-geronimo/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/transaction-geronimo/LICENSE.txt b/sandbox/old/contrib/transaction-geronimo/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/contrib/transaction-geronimo/NOTICE.txt b/sandbox/old/contrib/transaction-geronimo/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/NOTICE.txt
@@ -0,0 +1,14 @@
+${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/old/contrib/transaction-geronimo/pom.xml.off b/sandbox/old/contrib/transaction-geronimo/pom.xml.off
new file mode 100644
index 0000000000..34629a11ad
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/pom.xml.off
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.transaction</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-transaction-geronimo</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Geronimo Transaction Manager Extension</name>
+ <description>Geronomo transaction manager extension.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <version>1.0-alpha-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>mx4j</artifactId>
+ <groupId>mx4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-jelly-tags-velocity</artifactId>
+ <groupId>commons-jelly</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>velocity</artifactId>
+ <groupId>velocity</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-core</artifactId>
+ <groupId>geronimo</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-kernel</artifactId>
+ <groupId>geronimo</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-system</artifactId>
+ <groupId>geronimo</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-j2ee</artifactId>
+ <groupId>geronimo</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-ejb_2.1_spec</artifactId>
+ <groupId>org.apache.geronimo.specs</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceException.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceException.java
new file mode 100644
index 0000000000..925c35d76a
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * The base runtime exception for the transaction subsystem
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TransactionServiceException extends TuscanyRuntimeException {
+ public TransactionServiceException() {
+ }
+
+ public TransactionServiceException(String message) {
+ super(message);
+ }
+
+ public TransactionServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransactionServiceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceInitializationException.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceInitializationException.java
new file mode 100644
index 0000000000..d56e9d204d
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceInitializationException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo;
+
+/**
+ * Denotes an error initializing the transaction service
+ *
+ * @version $Rev$ $Date$
+ */
+public class TransactionServiceInitializationException extends TransactionServiceException {
+ public TransactionServiceInitializationException() {
+ }
+
+ public TransactionServiceInitializationException(String message) {
+ super(message);
+ }
+
+ public TransactionServiceInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransactionServiceInitializationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceShutdownException.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceShutdownException.java
new file mode 100644
index 0000000000..a39a6e9d6d
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/TransactionServiceShutdownException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo;
+
+/**
+ * Denotes an error shutting down the transaction service
+ *
+ * @version $Rev$ $Date$
+ */
+public class TransactionServiceShutdownException extends TransactionServiceException {
+ public TransactionServiceShutdownException() {
+ }
+
+ public TransactionServiceShutdownException(String message) {
+ super(message);
+ }
+
+ public TransactionServiceShutdownException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransactionServiceShutdownException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogService.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogService.java
new file mode 100644
index 0000000000..f3407f28d1
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogService.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.io.File;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.objectweb.howl.log.Configuration;
+
+/**
+ * A system service that wraps the Geronimo transaction log
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTransactionLogService {
+ private XidFactory xidFactory;
+ private StandaloneRuntimeInfo info;
+ private HOWLLog log;
+ private String logFileDir = ".";
+ private int maxBlocksPerFile = -1;
+ private int maxLogFiles = 2;
+ private int maxBuffers;
+ private int minBuffers = 4;
+ private int bufferSizeKBytes = 32;
+ private int flushSleepTimeMilliseconds = 50;
+ private String logFileExt = "log";
+ private String logFileName = "transaction";
+ private int threadsWaitingForceThreshold = -1;
+ private boolean checksumEnabled = true;
+ private String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer";
+
+ public GeronimoTransactionLogService(@Reference StandaloneRuntimeInfo info, @Reference XidFactory xidFactory) {
+ this.info = info;
+ this.xidFactory = xidFactory;
+ }
+
+ public String getLogFileDir() {
+ return logFileDir;
+ }
+
+ @Property
+ public void setLogFileDir(String logFileDir) {
+ this.logFileDir = logFileDir;
+ }
+
+ public int getMaxBlocksPerFile() {
+ return maxBlocksPerFile;
+ }
+
+ @Property
+ public void setMaxBlocksPerFile(int maxBlocksPerFile) {
+ this.maxBlocksPerFile = maxBlocksPerFile;
+ }
+
+ public int getMaxLogFiles() {
+ return maxLogFiles;
+ }
+
+ @Property
+ public void setMaxLogFiles(int maxLogFiles) {
+ this.maxLogFiles = maxLogFiles;
+ }
+
+ public int getMaxBuffers() {
+ return maxBuffers;
+ }
+
+ @Property
+ public void setMaxBuffers(int maxBuffers) {
+ this.maxBuffers = maxBuffers;
+ }
+
+ public int getMinBuffers() {
+ return minBuffers;
+ }
+
+ @Property
+ public void setMinBuffers(int minBuffers) {
+ this.minBuffers = minBuffers;
+ }
+
+ public int getBufferSizeKBytes() {
+ return bufferSizeKBytes;
+ }
+
+ @Property
+ public void setBufferSizeKBytes(int bufferSizeKBytes) {
+ this.bufferSizeKBytes = bufferSizeKBytes;
+ }
+
+ public int getFlushSleepTimeMilliseconds() {
+ return flushSleepTimeMilliseconds;
+ }
+
+ @Property
+ public void setFlushSleepTimeMilliseconds(int flushSleepTimeMilliseconds) {
+ this.flushSleepTimeMilliseconds = flushSleepTimeMilliseconds;
+ }
+
+ public String getLogFileExt() {
+ return logFileExt;
+ }
+
+ @Property
+ public void setLogFileExt(String logFileExt) {
+ this.logFileExt = logFileExt;
+ }
+
+ public String getLogFileName() {
+ return logFileName;
+ }
+
+ @Property
+ public void setLogFileName(String logFileName) {
+ this.logFileName = logFileName;
+ }
+
+ public int getThreadsWaitingForceThreshold() {
+ return threadsWaitingForceThreshold;
+ }
+
+ @Property
+ public void setThreadsWaitingForceThreshold(int threadsWaitingForceThreshold) {
+ this.threadsWaitingForceThreshold = threadsWaitingForceThreshold;
+ }
+
+ public boolean isChecksumEnabled() {
+ return checksumEnabled;
+ }
+
+ @Property
+ public void setChecksumEnabled(boolean checksumEnabled) {
+ this.checksumEnabled = checksumEnabled;
+ }
+
+ public String getBufferClassName() {
+ return bufferClassName;
+ }
+
+ @Property
+ public void setBufferClassName(String bufferClassName) {
+ this.bufferClassName = bufferClassName;
+ }
+
+ @Init
+ public void init() throws Exception {
+ Configuration config = new Configuration();
+ config.setBufferClassName(bufferClassName);
+ config.setBufferSize(bufferSizeKBytes);
+ config.setChecksumEnabled(checksumEnabled);
+ config.setFlushSleepTime(flushSleepTimeMilliseconds);
+ File logDir = new File(logFileDir);
+ if (!logDir.isAbsolute()) {
+ logDir = new File(info.getInstallDirectory(), logFileDir);
+ }
+ config.setLogFileDir(logDir.getAbsolutePath());
+ config.setLogFileExt(logFileExt);
+ config.setLogFileName(logFileName);
+ config.setMaxBlocksPerFile(maxBlocksPerFile == -1 ? Integer.MAX_VALUE : maxBlocksPerFile);
+ config.setMaxBuffers(maxBuffers);
+ config.setMaxLogFiles(maxLogFiles);
+ config.setMinBuffers(minBuffers);
+ config.setThreadsWaitingForceThreshold(
+ threadsWaitingForceThreshold == -1 ? Integer.MAX_VALUE : threadsWaitingForceThreshold);
+ log = new HOWLLog(config, xidFactory);
+ log.doStart();
+ }
+
+ @Destroy
+ public void destroy() throws Exception {
+ log.doStop();
+ }
+
+ public HOWLLog getLog() {
+ return log;
+ }
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerService.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerService.java
new file mode 100644
index 0000000000..45fdd19141
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerService.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.util.Map;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+
+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.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.host.ResourceHostRegistry;
+
+import org.apache.geronimo.transaction.ExtendedTransactionManager;
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.apache.geronimo.transaction.manager.XidImporter;
+import org.apache.tuscany.transaction.geronimo.TransactionServiceShutdownException;
+
+/**
+ * A <code>TransactionManager</code> that delegates to a Geronimo JTA transaction manager. This class serves as a
+ * wrapper for initializing the Geronimo TM as a system service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces = {TransactionManager.class, ExtendedTransactionManager.class})
+@EagerInit
+public class GeronimoTransactionManagerService implements TransactionManager, ExtendedTransactionManager {
+ private ResourceHostRegistry hostRegistry;
+ private ExtendedTransactionManager transactionManager;
+ private GeronimoTransactionLogService logService;
+ private int timeout = 250;
+
+ public GeronimoTransactionManagerService(@Reference ResourceHostRegistry hostRegistry,
+ @Reference GeronimoTransactionLogService logService) {
+ this.hostRegistry = hostRegistry;
+ this.logService = logService;
+ }
+
+ /**
+ * Returns the transaction timeout in seconds
+ *
+ * @return the transaction timeout in seconds
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the transaction timeout in seconds
+ */
+ @Property
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
+ @Init
+ public void init() throws XAException {
+ XidFactoryImpl factory = new XidFactoryImpl();
+ // FIXME fix passing in null ResourceManagers for recovery
+ transactionManager = new TransactionManagerImpl(timeout, factory, logService.getLog(), null);
+ hostRegistry.registerResource(TransactionManager.class, this);
+ }
+
+ @Destroy
+ public void destroy() throws TransactionServiceShutdownException {
+ hostRegistry.unregisterResource(TransactionManager.class);
+ }
+
+ public void begin() throws NotSupportedException, SystemException {
+ transactionManager.begin();
+ }
+
+ public void commit() throws HeuristicMixedException,
+ HeuristicRollbackException,
+ IllegalStateException,
+ RollbackException,
+ SecurityException,
+ SystemException {
+ transactionManager.commit();
+ }
+
+ public ExtendedTransactionManager getTransactionManager() {
+ return transactionManager;
+ }
+
+ public XidImporter getXidImporter() {
+ return (XidImporter) transactionManager;
+ }
+
+ public int getStatus() throws SystemException {
+ return transactionManager.getStatus();
+ }
+
+ public Transaction getTransaction() throws SystemException {
+ return transactionManager.getTransaction();
+ }
+
+ public void resume(Transaction transaction)
+ throws IllegalStateException, InvalidTransactionException, SystemException {
+ transactionManager.resume(transaction);
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException {
+ transactionManager.rollback();
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException {
+ transactionManager.setRollbackOnly();
+ }
+
+ public void setTransactionTimeout(int i) throws SystemException {
+ transactionManager.setTransactionTimeout(i);
+ }
+
+ public Transaction suspend() throws SystemException {
+ return transactionManager.suspend();
+ }
+
+
+ public Transaction begin(long timeout) throws NotSupportedException, SystemException {
+ return transactionManager.begin(timeout);
+ }
+
+ public Map getExternalXids() {
+ return transactionManager.getExternalXids();
+ }
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/HOWLLog.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/HOWLLog.java
new file mode 100644
index 0000000000..c5a5449212
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/HOWLLog.java
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.transaction.xa.Xid;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.transaction.manager.LogException;
+import org.apache.geronimo.transaction.manager.Recovery;
+import org.apache.geronimo.transaction.manager.TransactionBranchInfo;
+import org.apache.geronimo.transaction.manager.TransactionBranchInfoImpl;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.objectweb.howl.log.Configuration;
+import org.objectweb.howl.log.LogClosedException;
+import org.objectweb.howl.log.LogFileOverflowException;
+import org.objectweb.howl.log.LogRecord;
+import org.objectweb.howl.log.LogRecordSizeException;
+import org.objectweb.howl.log.LogRecordType;
+import org.objectweb.howl.log.ReplayListener;
+import org.objectweb.howl.log.xa.XACommittingTx;
+import org.objectweb.howl.log.xa.XALogRecord;
+import org.objectweb.howl.log.xa.XALogger;
+
+/**
+ * A copy of the Geronimo transaction log of the same class name. This was necessary to avoid a GBean dependency which
+ * had the side-effect of requiring a large number of additional Geronimo modules (referenced through transitive
+ * dependencies). At some point, this class should be eliminated if the Geronimo trasnaction manager can be made more
+ * modular.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HOWLLog implements TransactionLog {
+ private static final Log LOG = LogFactory.getLog(HOWLLog.class);
+ private static final byte COMMIT = 2;
+ private static final byte ROLLBACK = 3;
+
+ private final XidFactory xidFactory;
+ private final XALogger logger;
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private Map<Xid, Recovery.XidBranchesPair> recovered;
+
+ public HOWLLog(Configuration configuration, XidFactory xidFactory) throws IOException {
+ this.xidFactory = xidFactory;
+ this.logger = new XALogger(configuration);
+ }
+
+ public void doStart() throws Exception {
+ LOG.debug("Initiating transaction manager recovery");
+ recovered = new HashMap<Xid, Recovery.XidBranchesPair>();
+
+ logger.open(null);
+
+ ReplayListener replayListener = new GeronimoReplayListener(xidFactory, recovered);
+ logger.replayActiveTx(replayListener);
+
+ LOG.debug("In doubt transactions recovered from log");
+ }
+
+ public void doStop() throws Exception {
+ logger.close();
+ recovered = null;
+ }
+
+ public void doFail() {
+ }
+
+ public void begin(Xid xid) throws LogException {
+ }
+
+ public Object prepare(Xid xid, List branches) throws LogException {
+ int branchCount = branches.size();
+ byte[][] data = new byte[3 + 2 * branchCount][];
+ data[0] = intToBytes(xid.getFormatId());
+ data[1] = xid.getGlobalTransactionId();
+ data[2] = xid.getBranchQualifier();
+ int i = 3;
+ for (Object branche : branches) {
+ TransactionBranchInfo transactionBranchInfo = (TransactionBranchInfo) branche;
+ data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier();
+ data[i++] = transactionBranchInfo.getResourceName().getBytes();
+ }
+ try {
+ return logger.putCommit(data);
+ } catch (LogClosedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogRecordSizeException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogFileOverflowException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (InterruptedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (IOException e) {
+ throw new LogException(e);
+ }
+ }
+
+ public void commit(Xid xid, Object logMark) throws LogException {
+ //the data is theoretically unnecessary but is included to help with debugging and because HOWL
+ // currently requires it.
+ byte[][] data = new byte[4][];
+ data[0] = new byte[]{COMMIT};
+ data[1] = intToBytes(xid.getFormatId());
+ data[2] = xid.getGlobalTransactionId();
+ data[3] = xid.getBranchQualifier();
+ try {
+ logger.putDone(data, (XACommittingTx) logMark);
+ } catch (LogClosedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogRecordSizeException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogFileOverflowException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (InterruptedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (IOException e) {
+ throw new LogException(e);
+ }
+ }
+
+ public void rollback(Xid xid, Object logMark) throws LogException {
+ //the data is theoretically unnecessary but is included to help with debugging and because HOWL
+ // currently requires it.
+ byte[][] data = new byte[4][];
+ data[0] = new byte[]{ROLLBACK};
+ data[1] = intToBytes(xid.getFormatId());
+ data[2] = xid.getGlobalTransactionId();
+ data[3] = xid.getBranchQualifier();
+ try {
+ logger.putDone(data, (XACommittingTx) logMark);
+ } catch (LogClosedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogRecordSizeException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (LogFileOverflowException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (InterruptedException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ } catch (IOException e) {
+ throw new LogException(e);
+ }
+ }
+
+ public Collection recover(XidFactory xidFactory) throws LogException {
+ LOG.debug("Initiating transaction manager recovery");
+ Map<Xid, Recovery.XidBranchesPair> recovered = new HashMap<Xid, Recovery.XidBranchesPair>();
+ ReplayListener replayListener = new GeronimoReplayListener(xidFactory, recovered);
+ logger.replayActiveTx(replayListener);
+ LOG.debug("In doubt transactions recovered from log");
+ return recovered.values();
+ }
+
+ public String getXMLStats() {
+ return logger.getStats();
+ }
+
+ public int getAverageForceTime() {
+ return 0;
+ }
+
+ public int getAverageBytesPerForce() {
+ return 0;
+ }
+
+ private byte[] intToBytes(int formatId) {
+ byte[] buffer = new byte[4];
+ buffer[0] = (byte) (formatId >> 24);
+ buffer[1] = (byte) (formatId >> 16);
+ buffer[2] = (byte) (formatId >> 8);
+ buffer[3] = (byte) (formatId >> 0);
+ return buffer;
+ }
+
+ private int bytesToInt(byte[] buffer) {
+ return ((int) buffer[0]) << 24 + ((int) buffer[1]) << 16 + ((int) buffer[2]) << 8 + ((int) buffer[3]) << 0;
+ }
+
+ private class GeronimoReplayListener implements ReplayListener {
+
+ private final XidFactory xidFactory;
+ private final Map<Xid, Recovery.XidBranchesPair> recoveredTx;
+
+ public GeronimoReplayListener(XidFactory xidFactory, Map<Xid, Recovery.XidBranchesPair> recoveredTx) {
+ this.xidFactory = xidFactory;
+ this.recoveredTx = recoveredTx;
+ }
+
+ public void onRecord(LogRecord plainlr) {
+ XALogRecord lr = (XALogRecord) plainlr;
+ short recordType = lr.type;
+ XACommittingTx tx = lr.getTx();
+ if (recordType == LogRecordType.XACOMMIT) {
+
+ byte[][] data = tx.getRecord();
+
+ assert data[0].length == 4;
+ int formatId = bytesToInt(data[1]);
+ byte[] globalId = data[1];
+ byte[] branchId = data[2];
+ Xid masterXid = xidFactory.recover(formatId, globalId, branchId);
+
+ Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx);
+ recoveredTx.put(masterXid, xidBranchesPair);
+ LOG.debug("recovered prepare record for master xid: " + masterXid);
+ for (int i = 3; i < data.length; i += 2) {
+ byte[] branchBranchId = data[i];
+ String name = new String(data[i + 1]);
+
+ Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId);
+ TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name);
+ xidBranchesPair.addBranch(branchInfo);
+ LOG.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid);
+ }
+ } else {
+ if (recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started
+ LOG.warn("Received unexpected log record: " + lr + " (" + recordType + ")");
+ }
+ }
+ }
+
+ public void onError(org.objectweb.howl.log.LogException exception) {
+ LOG.error("Error during recovery: ", exception);
+ }
+
+ public LogRecord getLogRecord() {
+ //TODO justify this size estimate
+ return new LogRecord(10 * 2 * Xid.MAXBQUALSIZE);
+ }
+
+ }
+
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/XATerminatorService.java b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/XATerminatorService.java
new file mode 100644
index 0000000000..c97160dbe9
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/java/org/apache/tuscany/transaction/geronimo/jta/XATerminatorService.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import javax.resource.spi.XATerminator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.geronimo.transaction.ExtendedTransactionManager;
+import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.apache.geronimo.transaction.manager.XidImporter;
+
+/**
+ * Wraps the Geronimo <code>XATerminator</code> implementation to bootstrap it as a system service
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(XATerminator.class)
+public class XATerminatorService extends TransactionContextManager {
+
+ public XATerminatorService(@Reference ExtendedTransactionManager tm, @Reference XidImporter importer) {
+ super(tm, importer);
+ }
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/main/resources/META-INF/sca/geronimo.jta.scdl b/sandbox/old/contrib/transaction-geronimo/src/main/resources/META-INF/sca/geronimo.jta.scdl
new file mode 100644
index 0000000000..c330619227
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/main/resources/META-INF/sca/geronimo.jta.scdl
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<!--
+ Spring implementation extension configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.transaction.geronimo.JTAExtension">
+
+ <service name="TransactionManagerService">
+ <interface.java interface = "javax.transaction.TransactionManager"/>
+ <reference>TransactionManager</reference>
+ </service>
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.transaction</group>
+ <name>geronimo</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="TransactionLogService">
+ <system:implementation.system
+ class="org.apache.tuscany.transaction.geronimo.jta.GeronimoTransactionLogService"/>
+ </component>
+
+ <component name="XidFactory">
+ <system:implementation.system class="org.apache.geronimo.transaction.manager.XidFactoryImpl"/>
+ </component>
+
+ <component name="XATerminator">
+ <system:implementation.system class="org.apache.tuscany.transaction.geronimo.jta.XATerminatorService"/>
+ </component>
+
+ <component name="TransactionManager">
+ <system:implementation.system
+ class="org.apache.tuscany.transaction.geronimo.jta.GeronimoTransactionManagerService"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/TestUtils.java b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/TestUtils.java
new file mode 100644
index 0000000000..16867e741b
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/TestUtils.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class TestUtils {
+ private TestUtils() {
+ }
+
+ /**
+ * Removes log files from disk
+ */
+ public static void cleanupLog() {
+ File file = new File("transaction_1.log");
+ if (file.exists()) {
+ file.delete();
+ }
+ file = new File("transaction_2.log");
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTMServiceHostRegistryTestCase.java b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTMServiceHostRegistryTestCase.java
new file mode 100644
index 0000000000..2c08871ce7
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTMServiceHostRegistryTestCase.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.io.File;
+import javax.transaction.TransactionManager;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.easymock.EasyMock;
+
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.spi.host.ResourceHostRegistry;
+import org.apache.tuscany.transaction.geronimo.TestUtils;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTMServiceHostRegistryTestCase extends TestCase {
+ private GeronimoTransactionManagerService service;
+ private ResourceHostRegistry registry;
+
+ public void testRegisterUnregister() throws Exception {
+ service.init();
+ service.destroy();
+ EasyMock.verify(registry);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ registry = EasyMock.createMock(ResourceHostRegistry.class);
+ registry.registerResource(EasyMock.eq(TransactionManager.class), EasyMock.isA(TransactionManager.class));
+ registry.unregisterResource(EasyMock.eq(TransactionManager.class));
+ EasyMock.replay(registry);
+ StandaloneRuntimeInfo info = EasyMock.createMock(StandaloneRuntimeInfo.class);
+ EasyMock.expect(info.getInstallDirectory()).andReturn(new File("."));
+ EasyMock.replay(info);
+ GeronimoTransactionLogService logService = new GeronimoTransactionLogService(info, new XidFactoryImpl());
+ service = new GeronimoTransactionManagerService(registry, logService);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanupLog();
+ }
+
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogServiceTestCase.java b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogServiceTestCase.java
new file mode 100644
index 0000000000..6acf753d5e
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionLogServiceTestCase.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.easymock.EasyMock;
+
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.transaction.geronimo.TestUtils;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTransactionLogServiceTestCase extends TestCase {
+ private GeronimoTransactionLogService service;
+
+ public void testInitialization() throws Exception {
+ service.setBufferSizeKBytes(32);
+ service.setChecksumEnabled(true);
+ service.setFlushSleepTimeMilliseconds(3000);
+ service.setLogFileDir(".");
+ service.setLogFileExt("log");
+ service.setLogFileName("transaction");
+ service.setMaxBlocksPerFile(10000);
+ service.setMaxBuffers(1000);
+ service.setMaxLogFiles(2);
+ service.setMinBuffers(20);
+ service.setThreadsWaitingForceThreshold(1000);
+ service.init();
+ service.destroy();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ StandaloneRuntimeInfo info = EasyMock.createMock(StandaloneRuntimeInfo.class);
+ EasyMock.expect(info.getInstallDirectory()).andReturn(new File("."));
+ EasyMock.replay(info);
+ service = new GeronimoTransactionLogService(info, new XidFactoryImpl());
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TestUtils.cleanupLog();
+ }
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerServiceTestCase.java b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerServiceTestCase.java
new file mode 100644
index 0000000000..5c1fbb9008
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/test/java/org/apache/tuscany/transaction/geronimo/jta/GeronimoTransactionManagerServiceTestCase.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.transaction.geronimo.jta;
+
+import java.io.File;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.easymock.EasyMock;
+
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.spi.host.ResourceHostRegistry;
+import org.apache.tuscany.transaction.geronimo.TestUtils;
+
+/**
+ * Sanity checks for the Geronimo Transaction Manager
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTransactionManagerServiceTestCase extends TestCase {
+ private GeronimoTransactionManagerService service;
+
+ public void testBeginCommit() throws Exception {
+ service.init();
+ service.begin();
+ Transaction trx = service.getTransaction();
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.commit();
+ assertEquals(Status.STATUS_NO_TRANSACTION, trx.getStatus());
+ service.destroy();
+ }
+
+ public void testBeginRollback() throws Exception {
+ service.init();
+ service.begin();
+ Transaction trx = service.getTransaction();
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.rollback();
+ assertEquals(Status.STATUS_NO_TRANSACTION, trx.getStatus());
+ service.destroy();
+ }
+
+ public void testBeginRollbackOnly() throws Exception {
+ service.init();
+ service.begin();
+ Transaction trx = service.getTransaction();
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.setRollbackOnly();
+ assertEquals(Status.STATUS_MARKED_ROLLBACK, trx.getStatus());
+ service.rollback();
+ assertEquals(Status.STATUS_NO_TRANSACTION, trx.getStatus());
+ service.destroy();
+ }
+
+ public void testBeginRollbackOnlyBadCommit() throws Exception {
+ service.init();
+ service.begin();
+ Transaction trx = service.getTransaction();
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.setRollbackOnly();
+ assertEquals(Status.STATUS_MARKED_ROLLBACK, trx.getStatus());
+ try {
+ service.commit();
+ fail();
+ } catch (RollbackException e) {
+ // expected
+ }
+ }
+
+ public void testSuspendResume() throws Exception {
+ service.begin();
+ Transaction trx = service.getTransaction();
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ trx = service.suspend();
+ assertNull(service.getTransaction());
+ service.resume(trx);
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.commit();
+ assertEquals(Status.STATUS_NO_TRANSACTION, trx.getStatus());
+ }
+
+ public void testSynchronization() throws Exception {
+ Synchronization sync = createSynchronization();
+ service.init();
+ service.getTransactionManager();
+ service.begin();
+ Transaction trx = service.getTransaction();
+ trx.registerSynchronization(sync);
+ assertEquals(Status.STATUS_ACTIVE, trx.getStatus());
+ service.commit();
+ assertEquals(Status.STATUS_NO_TRANSACTION, trx.getStatus());
+ service.destroy();
+ EasyMock.verify(sync);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TestUtils.cleanupLog();
+ ResourceHostRegistry registry = EasyMock.createNiceMock(ResourceHostRegistry.class);
+ EasyMock.replay(registry);
+ StandaloneRuntimeInfo info = EasyMock.createMock(StandaloneRuntimeInfo.class);
+ EasyMock.expect(info.getInstallDirectory()).andReturn(new File("."));
+ EasyMock.replay(info);
+ GeronimoTransactionLogService logService = new GeronimoTransactionLogService(info, new XidFactoryImpl());
+ service = new GeronimoTransactionManagerService(registry, logService);
+ service.init();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ service.destroy();
+ TestUtils.cleanupLog();
+ }
+
+ private Synchronization createSynchronization() {
+ Synchronization sync = EasyMock.createMock(Synchronization.class);
+ sync.beforeCompletion();
+ sync.afterCompletion(EasyMock.anyInt());
+ EasyMock.replay(sync);
+ return sync;
+ }
+
+}
diff --git a/sandbox/old/contrib/transaction-geronimo/src/test/resources/META-INF/sca/test.scdl b/sandbox/old/contrib/transaction-geronimo/src/test/resources/META-INF/sca/test.scdl
new file mode 100644
index 0000000000..05b0368a6f
--- /dev/null
+++ b/sandbox/old/contrib/transaction-geronimo/src/test/resources/META-INF/sca/test.scdl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="jta.test">
+ <!-- intentionally left blank -->
+
+</composite>
diff --git a/sandbox/old/distribution/pom.xml b/sandbox/old/distribution/pom.xml
new file mode 100644
index 0000000000..0b8ca78fb0
--- /dev/null
+++ b/sandbox/old/distribution/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>2-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.distribution</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany Distributions</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>apache-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/maven-snapshot-repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>codehaus-snapshot</id>
+ <name>Codehaus Snapshot Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <modules>
+ <module>sca</module>
+ </modules>
+</project>
diff --git a/sandbox/old/distribution/sca/pom.xml b/sandbox/old/distribution/sca/pom.xml
new file mode 100644
index 0000000000..27ef87627d
--- /dev/null
+++ b/sandbox/old/distribution/sca/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.distribution</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany SCA Distributions</name>
+ <description>Tuscany Distribution for SCA.</description>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>demo.app</module>
+ <module>demo</module>
+ </modules>
+</project>
diff --git a/sandbox/old/distribution/sca/standalone/LICENSE.txt b/sandbox/old/distribution/sca/standalone/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/distribution/sca/standalone/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/distribution/sca/standalone/NOTICE.txt b/sandbox/old/distribution/sca/standalone/NOTICE.txt
new file mode 100644
index 0000000000..960b43965e
--- /dev/null
+++ b/sandbox/old/distribution/sca/standalone/NOTICE.txt
@@ -0,0 +1,19 @@
+=========================================================================
+== 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/).
+
+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.
+
+Please read the LICENSE.txt file present in the root directory of this distribution.
+
diff --git a/sandbox/old/distribution/sca/standalone/extensions.scdl b/sandbox/old/distribution/sca/standalone/extensions.scdl
new file mode 100644
index 0000000000..2dee53ae52
--- /dev/null
+++ b/sandbox/old/distribution/sca/standalone/extensions.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Composite containing definitions for contributed extensions.
+ Extensions can be enabled either by including them in this file or
+ by copying their SCDL or jar file to the extensions directory.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.sca.distribution.Extensions">
+</composite> \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/standalone/pom.xml b/sandbox/old/distribution/sca/standalone/pom.xml
new file mode 100644
index 0000000000..1fc33b42f0
--- /dev/null
+++ b/sandbox/old/distribution/sca/standalone/pom.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <artifactId>standalone</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany Standalone Distribution</name>
+ <description>Tuscany Distribution for a standalone runtime environment.</description>
+
+ <properties>
+ <sca.version>1.0-incubator-SNAPSHOT</sca.version>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <!-- dependencies for base distribution -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>launcher</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>maven</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+
+ <dependency> <!-- needed for axis even on client side-->
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- dependencies for contributed extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>rmi</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>javascript</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>ruby</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>spring</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/standalone.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/distribution/sca/standalone/src/main/assembly/standalone.xml b/sandbox/old/distribution/sca/standalone/src/main/assembly/standalone.xml
new file mode 100644
index 0000000000..ea5b5b606b
--- /dev/null
+++ b/sandbox/old/distribution/sca/standalone/src/main/assembly/standalone.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <fileSets>
+ <!-- include legal and other files -->
+ <fileSet>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- empty fileSet to create the extensions directory -->
+ <fileSet>
+ <outputDirectory>extensions</outputDirectory>
+ <includes>
+ <include>extensions.scdl</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+
+ <dependencySets>
+ <!-- include commands in bin directory (without versions) -->
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:launcher</include>
+ </includes>
+ <excludes>
+ <exclude>org.osoa:sca-api</exclude>
+ </excludes>
+ <fileMode>755</fileMode>
+ </dependencySet>
+
+ <!-- include libraries in lib directory (with versions) -->
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>org.osoa:sca-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-api</include>
+ <include>javax.servlet:servlet-api</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-host</exclude>
+ </excludes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+
+ <!-- libraries needed to boot the runtime -->
+ <dependencySet>
+ <outputDirectory>boot</outputDirectory>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ <include>org.apache.tuscany.sca.kernel:core</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-spi</include>
+ <include>org.apache.tuscany.sca.services:maven</include>
+ <include>stax:stax-api</include>
+ <include>woodstox:wstx-asl</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ </excludes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+
+ <!-- contributed extensions -->
+ <dependencySet>
+ <outputDirectory>contrib</outputDirectory>
+ <scope>compile</scope>
+ <includes>
+ <include>org.apache.tuscany.sca.services.bindings:axis2</include>
+ <include>org.apache.tuscany.sca.services.bindings:rmi</include>
+ <include>org.apache.tuscany.sca.services.containers:javascript</include>
+ <include>org.apache.tuscany.sca.services.containers:ruby</include>
+ <include>org.apache.tuscany.sca.services.containers:spring</include>
+ <include>org.apache.tuscany.sca.services.databinding:databinding-sdo</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca.kernel:tuscany-spi</exclude>
+ <!-- dependencies from binding.axis2 -->
+ <exclude>axis2:axis2-kernel</exclude>
+ <exclude>org.apache.ws.commons.axiom:axiom-api</exclude>
+ <exclude>org.apache.ws.commons.axiom:axiom-impl</exclude>
+ <exclude>org.apache.ws.commons.schema:XmlSchema</exclude>
+ <exclude>incubator-woden:woden</exclude>
+ <exclude>wsdl4j:wsdl4j</exclude>
+ <exclude>org.apache.tuscany.sca.services.idl:wsdl</exclude>
+
+ <!-- dependencies from binding.rmi -->
+ <exclude>cglib:cglib-nodep</exclude>
+
+ <!-- dependencies from container.javascript -->
+ <exclude>rhino:js</exclude>
+ <exclude>xmlbeans:xbean</exclude>
+
+ <!-- dependencies from container.ruby -->
+ <exclude>org.jruby:jruby</exclude>
+
+ <!-- dependencies from container.spring -->
+ <exclude>org.springframework:spring</exclude>
+ <exclude>org.apache.tuscany.sca.runtime:webapp</exclude>
+
+ <!-- dependencies from databinding.sdo -->
+ <exclude>org.apache.tuscany.sdo:tuscany-sdo-impl</exclude>
+
+ </excludes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/sandbox/old/distribution/sca/tsss-demo/README.txt b/sandbox/old/distribution/sca/tsss-demo/README.txt
new file mode 100644
index 0000000000..6a0d6b4b96
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/README.txt
@@ -0,0 +1,59 @@
+Project to build the assembly used for the demo at TheServerSide Symposium, March 2007
+======================================================================================
+
+This project is configured to use a combination of stable and unstable code from Tuscany.
+It is built using Maven using a mixture of
+* released artifacts downloaded from online repositories
+* stable but unreleased artifacts that need to be built locally
+* unstable references to modules included using svn externals
+
+Released artifacts
+------------------
+These are a combination of artifacts previously released by Tuscany with the approval
+of the Incubator PMC. These include the project-wide parent pom, buildtools and the
+commonj work manager API from our M2 release.
+
+We also have dependencies on artifacts released by other projects such as Jetty and ActiveMQ.
+
+These artifacts will automatically be downloaded by Maven during the online build.
+
+
+Stable but unreleased artifacts
+-------------------------------
+These are two modules from Tuscany that have been tagged but not formally released.
+These must be built on your local machine from source before building this project.
+
+The URLs for these tags are:
+ https://svn.apache.org/repos/asf/incubator/tuscany/tags/java/pom/sca/1.0-incubating
+ https://svn.apache.org/repos/asf/incubator/tuscany/tags/java/spec/sca-api-r1.0/1.0-incubating
+
+The source for these is frozen and once approval is given by the Incubator PMC they
+can be published to the online Maven repo. They would then be downloaded like the
+Released Artifacts above.
+
+Until then you should checkout and build each manually:
+ $ svn export https://svn.apache.org/repos/asf/incubator/tuscany/tags/java/pom/sca/1.0-incubating sca-pom
+ $ cd sca-pom
+ $ mvn install
+
+ $ svn export https://svn.apache.org/repos/asf/incubator/tuscany/tags/java/spec/sca-api-r1.0/1.0-incubating sca-api-r1.0
+ $ cd sca-api-r1.0
+ $ mvn install
+
+
+References to unstable modules
+------------------------------
+
+This project makes use of modules from the trunk that are under active development.
+They are included in this project using svn externals and should automatically have
+been checked out when you checked out this directory. These will automatically be
+updated to the latest code when you "svn up" this project. They are included in
+the build for this project and will be built with it.
+
+
+Building this project
+---------------------
+
+Once you have built and installed the stable but unreleased artifacts above,
+you can build this project with:
+ $ mvn install \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo.app/LICENSE.txt b/sandbox/old/distribution/sca/tsss-demo/demo.app/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo.app/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/distribution/sca/tsss-demo/demo.app/NOTICE.txt b/sandbox/old/distribution/sca/tsss-demo/demo.app/NOTICE.txt
new file mode 100644
index 0000000000..b18217bd7a
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo.app/NOTICE.txt
@@ -0,0 +1,163 @@
+${project.name}
+Copyright (c) 2005 - 2007 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/).
+
+----- NOTICE from LICENSE.txt file for classworlds project --------------------
+* profiles/launcher/boot/classworlds-1.1.jar
+-------------------------------------------------------------------------------
+
+/*
+ $Id$
+
+ Copyright 2002 (C) The Codehaus. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "classworlds" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission, please
+ contact bob@codehaus.org.
+
+ 4. Products derived from this Software may not be called "classworlds"
+ nor may "classworlds" appear in their names without prior written
+ permission of The Codehaus. "classworlds" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus.
+ (http://classworlds.codehaus.org/).
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+----- NOTICE from LICENSE.txt file in jsch-0.1.24 distribution ----------------
+* profiles/launcher/boot/jsch-0.1.24.jar
+-------------------------------------------------------------------------------
+
+JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2002,2003,2004,2005 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----- NOTICE from Codehaus for Plexus Project ---------------------------------
+* profiles/launcher/boot/plexus-container-default-1.0-alpha-9.jar
+* profiles/launcher/boot/plexus-interactivity-api-1.0-alpha-4.jar
+* profiles/launcher/boot/plexus-utils-1.1.jar
+-------------------------------------------------------------------------------
+
+ The MIT License
+
+ Copyright (c) 2004, The Codehaus
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+-----
+
+Some portions of Plexus are also distributed under other BSD-style licenses
+including the Apache License Version 2.0
+
+----- NOTICE from StAX project at http://svn.codehaus.org/stax/trunk/dev/README-API.txt
+* profiles/launcher/boot/stax-api-1.0.1.jar
+-------------------------------------------------------------------------------
+
+These files together comprise the API for JSR 173 (Streaming API for XML Specification), including its API classes and interfaces.
+
+
+The following lists the files in this distribution:
+
+README-API.txt [README file for JSR 173 api bundle.]
+ASF2.0.txt [Apache Software Foundation License 2.0.]
+jsr173_1.0_api.jar [The API classes and interfaces in binary format.]
+jsr173_1.0_src.jar [The API classes and interfaces in source format.]
+
+Your right to use the listed files, whether together or individually, is governed by the Apache Software Foundation License 2.0 included in this bundle.
+
+Please see the javadoc for information on how to get started.
+
+----- NOTICE from wstx-asl-3.2.0.jar ------------------------------------------
+* profiles/launcher/boot/wstx-asl-3.2.0.jar
+-------------------------------------------------------------------------------
+
+This product currently only contains code developed by authors
+of specific components, as identified by the source code files.
+
+Since product implements StAX API, it has dependencies to StAX API
+classes.
+
+For additional credits (generally to people who reported problems)
+see CREDITS file.
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo.app/pom.xml b/sandbox/old/distribution/sca/tsss-demo/demo.app/pom.xml
new file mode 100644
index 0000000000..9b79c61ee5
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo.app/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>demo-app</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Tuscany Demo Application</name>
+ <description>Tuscany Demo Application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.core-samples.common</groupId>
+ <artifactId>calculator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- compiler plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorForm.java b/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorForm.java
new file mode 100644
index 0000000000..e997032217
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorForm.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.demo.app;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.spi.host.ServletHost;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("serial")
+@EagerInit
+@Service(Servlet.class)
+public class CalculatorForm extends HttpServlet {
+
+ /**
+ * Injects the servlet host.
+ *
+ * @param servletHost Servlet host to use.
+ */
+ @Reference
+ public void setServletHost(ServletHost servletHost) {
+ servletHost.registerMapping("/calculatorForm", this);
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException Servlet exception.
+ * @throws IOException IO Exception.
+ */
+ protected void process(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+
+ PrintWriter writer = res.getWriter();
+ writer.println("<form name='' method='post' action='calculate'>");
+ writer.println("<input name='op1' type='text' size='10'>");
+ writer.println("<br/>");
+ writer.println("<input name='op2' type='text' size='10'>");
+ writer.println("<br/>");
+ writer.println("<input type='submit' value='Add'/>");
+ writer.println("</form>");
+ writer.flush();
+ writer.close();
+
+ }
+
+ /**
+ * Handles get requests.
+ */
+ @Override
+ protected final void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+ /**
+ * Handles post request.
+ */
+ @Override
+ protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+}
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorHandler.java b/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorHandler.java
new file mode 100644
index 0000000000..771f0828ca
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo.app/src/main/java/org/apache/tuscany/demo/app/CalculatorHandler.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.demo.app;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.core.component.SimpleWorkContext;
+import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.core.implementation.java.JavaComponent;
+import org.apache.tuscany.spi.component.ComponentManager;
+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.host.ServletHost;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import calculator.CalculatorService;
+
+/**
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("serial")
+@EagerInit
+@Service(Servlet.class)
+public class CalculatorHandler extends HttpServlet {
+
+ // Calculator service
+ private ComponentManager componentManager;
+
+ /**
+ * Injects the servlet host.
+ *
+ * @param servletHost Servlet host to use.
+ */
+ @Reference
+ public void setServletHost(ServletHost servletHost) {
+ servletHost.registerMapping("/calculate", this);
+ }
+
+ /**
+ * Injects the calculator.
+ *
+ * @param componentManager Component manager.
+ */
+ @Reference
+ public void setComponentManager(ComponentManager componentManager) {
+ this.componentManager = componentManager;
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @param req Servlet request.
+ * @param res Servlet response.
+ * @throws ServletException Servlet exception.
+ * @throws IOException IO Exception.
+ */
+ protected void process(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+
+
+ try {
+
+ PojoWorkContextTunnel.setThreadWorkContext(new SimpleWorkContext());
+
+ URI calculatorServiceUri = new URI("tuscany://./domain/CalculatorServiceComponent");
+
+ JavaComponent javaComponent = (JavaComponent) componentManager.getComponent(calculatorServiceUri);
+
+ ScopeContainer scopeContainer = javaComponent.getScopeContainer();
+ InstanceWrapper wrapper = scopeContainer.getWrapper(javaComponent, new URI("tuscany://./domain"));
+ CalculatorService calculatorService = (CalculatorService) wrapper.getInstance();
+ double op1 = Double.parseDouble(req.getParameter("op1"));
+ double op2 = Double.parseDouble(req.getParameter("op2"));
+ double result = calculatorService.add(op1, op2);
+
+ PrintWriter writer = res.getWriter();
+ writer.println("Result: " + result);
+ writer.flush();
+ writer.close();
+ } catch (URISyntaxException ex) {
+ throw new ServletException(ex);
+ } catch (TargetResolutionException ex) {
+ throw new ServletException(ex);
+ }
+ }
+
+ /**
+ * Handles get requests.
+ */
+ @Override
+ protected final void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+ /**
+ * Handles post request.
+ */
+ @Override
+ protected final void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ process(req, res);
+ }
+
+}
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/LICENSE.txt b/sandbox/old/distribution/sca/tsss-demo/demo/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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/old/distribution/sca/tsss-demo/demo/NOTICE.txt b/sandbox/old/distribution/sca/tsss-demo/demo/NOTICE.txt
new file mode 100644
index 0000000000..b18217bd7a
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/NOTICE.txt
@@ -0,0 +1,163 @@
+${project.name}
+Copyright (c) 2005 - 2007 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/).
+
+----- NOTICE from LICENSE.txt file for classworlds project --------------------
+* profiles/launcher/boot/classworlds-1.1.jar
+-------------------------------------------------------------------------------
+
+/*
+ $Id$
+
+ Copyright 2002 (C) The Codehaus. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "classworlds" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission, please
+ contact bob@codehaus.org.
+
+ 4. Products derived from this Software may not be called "classworlds"
+ nor may "classworlds" appear in their names without prior written
+ permission of The Codehaus. "classworlds" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus.
+ (http://classworlds.codehaus.org/).
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+----- NOTICE from LICENSE.txt file in jsch-0.1.24 distribution ----------------
+* profiles/launcher/boot/jsch-0.1.24.jar
+-------------------------------------------------------------------------------
+
+JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2002,2003,2004,2005 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----- NOTICE from Codehaus for Plexus Project ---------------------------------
+* profiles/launcher/boot/plexus-container-default-1.0-alpha-9.jar
+* profiles/launcher/boot/plexus-interactivity-api-1.0-alpha-4.jar
+* profiles/launcher/boot/plexus-utils-1.1.jar
+-------------------------------------------------------------------------------
+
+ The MIT License
+
+ Copyright (c) 2004, The Codehaus
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+-----
+
+Some portions of Plexus are also distributed under other BSD-style licenses
+including the Apache License Version 2.0
+
+----- NOTICE from StAX project at http://svn.codehaus.org/stax/trunk/dev/README-API.txt
+* profiles/launcher/boot/stax-api-1.0.1.jar
+-------------------------------------------------------------------------------
+
+These files together comprise the API for JSR 173 (Streaming API for XML Specification), including its API classes and interfaces.
+
+
+The following lists the files in this distribution:
+
+README-API.txt [README file for JSR 173 api bundle.]
+ASF2.0.txt [Apache Software Foundation License 2.0.]
+jsr173_1.0_api.jar [The API classes and interfaces in binary format.]
+jsr173_1.0_src.jar [The API classes and interfaces in source format.]
+
+Your right to use the listed files, whether together or individually, is governed by the Apache Software Foundation License 2.0 included in this bundle.
+
+Please see the javadoc for information on how to get started.
+
+----- NOTICE from wstx-asl-3.2.0.jar ------------------------------------------
+* profiles/launcher/boot/wstx-asl-3.2.0.jar
+-------------------------------------------------------------------------------
+
+This product currently only contains code developed by authors
+of specific components, as identified by the source code files.
+
+Since product implements StAX API, it has dependencies to StAX API
+classes.
+
+For additional credits (generally to people who reported problems)
+see CREDITS file.
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/demo.xml b/sandbox/old/distribution/sca/tsss-demo/demo/demo.xml
new file mode 100644
index 0000000000..d3b7992566
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/demo.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <files>
+ <!-- include legal and other files -->
+ <file>
+ <source>LICENSE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ <file>
+ <source>NOTICE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ </file>
+ </files>
+
+ <fileSets>
+ <!-- include assembly files -->
+ <fileSet>
+ <directory>src/main</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <!-- copy executable commands to the bin directory without version info -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:server.start</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-api</exclude>
+ <exclude>org.apache.tuscany.sca.runtime.services.management:management-jmx</exclude>
+ <exclude>javax.servlet:servlet-api</exclude>
+ </excludes>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <fileMode>755</fileMode>
+ </dependencySet>
+
+ <!-- copy dependencies used by the executable commands to the lib directory -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-api</include>
+ <include>org.osoa:sca-api-r1.0</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ <include>org.apache.tuscany.sca.runtime.services.management:management-jmx</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-spi</include>
+ <include>javax.servlet:servlet-api</include>
+ <include>org.codehaus.woodstox:wstx-asl</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>org.easymock:easymock</exclude>
+ </excludes>
+ <outputDirectory>lib</outputDirectory>
+ <outputFileNameMapping>${artifactId}-${baseVersion}.${extension}</outputFileNameMapping>
+ </dependencySet>
+
+ <!-- copy boot dependencies to master profile -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ <include>org.apache.tuscany.sca.services:http-jetty</include>
+ <include>org.apache.tuscany:tuscany-sca-console</include>
+ <include>org.apache.tuscany.sca.runtime.services.discovery:discovery-jms</include>
+ <include>org.apache.tuscany.sca.core-samples.common:calculator</include>
+ <include>org.apache.tuscany.distribution.sca:demo-app</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>org.easymock:easymock</exclude>
+ <exclude>javax.servlet:servlet-api</exclude>
+ </excludes>
+ <outputDirectory>profiles/master/boot</outputDirectory>
+ </dependencySet>
+
+ <!-- copy boot dependencies to slave1 profile -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ <include>org.apache.tuscany.sca.services:http-jetty</include>
+ <include>org.apache.tuscany.sca.runtime.services.discovery:discovery-jms</include>
+ <include>org.apache.tuscany.sca.core-samples.common:calculator</include>
+ <include>org.apache.tuscany.distribution.sca:demo-app</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>org.easymock:easymock</exclude>
+ <exclude>javax.servlet:servlet-api</exclude>
+ </excludes>
+ <outputDirectory>profiles/slave1/boot</outputDirectory>
+ </dependencySet>
+
+ <!-- copy boot dependencies to slave2 profile -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ <include>org.apache.tuscany.sca.services:http-jetty</include>
+ <include>org.apache.tuscany.sca.runtime.services.discovery:discovery-jms</include>
+ <include>org.apache.tuscany.sca.core-samples.common:calculator</include>
+ <include>org.apache.tuscany.distribution.sca:demo-app</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>org.easymock:easymock</exclude>
+ <exclude>javax.servlet:servlet-api</exclude>
+ </excludes>
+ <outputDirectory>profiles/slave2/boot</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
+
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/pom.xml b/sandbox/old/distribution/sca/tsss-demo/demo/pom.xml
new file mode 100644
index 0000000000..6ebb134e9c
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <artifactId>demo</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany Standalone Distribution</name>
+ <description>Tuscany Distribution for a standalone runtime environment.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>server.start</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.discovery</groupId>
+ <artifactId>tuscany-jms-discovery</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.transport</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-console</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.core-samples.common</groupId>
+ <artifactId>calculator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>demo-app</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>demo.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/etc/runtime.properties b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/etc/runtime.properties
new file mode 100644
index 0000000000..cd1e824731
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/etc/runtime.properties
@@ -0,0 +1 @@
+domain=federation-demo \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/system.scdl b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/system.scdl
new file mode 100644
index 0000000000..88d3d0a6b2
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/master/system.scdl
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+<!--
+Default system configuration for the launcher environment.
+
+$Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System" autowire="true">
+
+ <!-- Work manager -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+ <!-- Generator Registry -->
+ <component name="generatorRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.generator.GeneratorRegistryImpl"/>
+ </component>
+
+ <component name="javaGenerator">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.java.JavaPhysicalComponentGenerator"/>
+ </component>
+
+
+ <!-- JXTA network configurator -->
+ <!-- component name="networkConfigurator">
+ <system:implementation.system
+ class="net.jxta.platform.NetworkConfigurator"/>
+ <property name="principal">principal</property>
+ <property name="password">password</property>
+ </component-->
+
+ <!-- Discovery service -->
+ <!--component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService"/>
+ <property name="interval">5000</property>
+ <reference name="configurator" target="networkConfigurator"/>
+ <reference name="workScheduler" target="workScheduler"/>
+ </component-->
+
+ <!-- JMS discovery service -->
+ <component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jms.JmsDiscoveryService"/>
+ <property name="topic">tuscany.federation</property>
+ </component>
+
+ <!-- Marshaller registry -->
+ <component name="marshallerRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.DefaultModelMarshallerRegistry"/>
+ </component>
+
+ <!-- Changeset marshaller -->
+ <component name="changeSetMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalChangeSetMarshaller"/>
+ </component>
+
+ <!-- Wide definition marshaller -->
+ <component name="wireDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalWireDefinitionMarshaller"/>
+ </component>
+
+ <!-- Operation definition marshaller -->
+ <component name="operationMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalOperationDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java component definition marshaller -->
+ <component name="javaComponentDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalComponentDefinitionMarshaller"/>
+ </component>
+
+ <!-- Reflective IF provider definition marshaller -->
+ <component name="reflectiveIfProviderDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.instancefactory.ReflectiveIFProviderDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire source definition marshaller -->
+ <component name="javaWireSourceDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireSourceDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire target definition marshaller -->
+ <component name="javaWireTargetDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireTargetDefinitionMarshaller"/>
+ </component>
+
+ <!-- Builder registry -->
+ <component name="builderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.physical.DefaultPhysicalComponentBuilderRegistry"/>
+ </component>
+ <component name="wireAttacherRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.physical.WireAttacherRegistryImpl"/>
+ </component>
+ <component name="providerBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.DefaultIFProviderBuilderRegistry"/>
+ </component>
+
+ <component name="reflectiveIFProviderBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.ReflectiveIFProviderBuilder"/>
+ </component>
+
+ <!-- Java physical component builder -->
+ <component name="javaPhysicalComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.java.JavaPhysicalComponentBuilder"/>
+ </component>
+
+ <!-- Federated deployer -->
+ <component name="federateDeployer">
+ <system:implementation.system
+ class="org.apache.tuscany.core.deployer.federation.FederatedDeployer"/>
+ </component>
+
+ <!-- Jetty HTTP service -->
+ <component name="httpService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.jetty.JettyServiceImpl"/>
+ <property name="httpPort">7000</property>
+ </component>
+
+ <!-- Console -->
+ <include name="org.apache.tuscany.sca.console"
+ scdlResource="org/apache/tuscany/console/console.scdl"/>
+
+ <!-- Assembly service -->
+ <component name="assemblyService">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.deployment.AssemblyServiceImpl"/>
+ </component>
+
+
+ <!--_________________________________________________________________________________________-->
+
+ <!--__________________________Legacy from launcher SCDL _____________________________________-->
+
+ <!--_________________________________________________________________________________________-->
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system
+ class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system
+ class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system
+ class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system
+ class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+ <!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+ -->
+ <!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+ -->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader"
+ scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding"
+ scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation"
+ scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava"
+ scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite"
+ scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation"
+ scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation"
+ scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">
+ 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/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system
+ class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <component name="launchedLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedLoader"/>
+ </component>
+
+ <component name="launchedComponentLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentTypeLoader"/>
+ </component>
+
+ <component name="launchedComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentBuilder"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="loaderExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="incompatibleServiceContractExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/etc/runtime.properties b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/etc/runtime.properties
new file mode 100644
index 0000000000..cd1e824731
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/etc/runtime.properties
@@ -0,0 +1 @@
+domain=federation-demo \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/system.scdl b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/system.scdl
new file mode 100644
index 0000000000..2a6a684e87
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave1/system.scdl
@@ -0,0 +1,337 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+<!--
+Default system configuration for the launcher environment.
+
+$Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System" autowire="true">
+
+ <!-- Work manager -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <!-- JXTA network configurator -->
+ <!-- component name="networkConfigurator">
+ <system:implementation.system
+ class="net.jxta.platform.NetworkConfigurator"/>
+ <property name="principal">principal</property>
+ <property name="password">password</property>
+ </component-->
+
+ <!-- Discovery service -->
+ <!--component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService"/>
+ <property name="interval">5000</property>
+ <reference name="configurator" target="networkConfigurator"/>
+ <reference name="workScheduler" target="workScheduler"/>
+ </component-->
+
+ <!-- JMS discovery service -->
+ <component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jms.JmsDiscoveryService"/>
+ <property name="topic">tuscany.federation</property>
+ </component>
+
+ <!-- Marshaller registry -->
+ <component name="marshallerRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.DefaultModelMarshallerRegistry"/>
+ </component>
+
+ <!-- Changeset marshaller -->
+ <component name="changeSetMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.PhysicalChangeSetMarshaller"/>
+ </component>
+
+ <!-- Wide definition marshaller -->
+ <component name="wireDefinitionMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.PhysicalWireDefinitionMarshaller"/>
+ </component>
+
+ <!-- Operation definition marshaller -->
+ <component name="operationMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.PhysicalOperationDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java component definition marshaller -->
+ <component name="javaComponentDefinitionMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalComponentDefinitionMarshaller"/>
+ </component>
+
+ <!-- Reflective IF provider definition marshaller -->
+ <component name="reflectiveIfProviderDefinitionMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.extensions.instancefactory.ReflectiveIFProviderDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire source definition marshaller -->
+ <component name="javaWireSourceDefinitionMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireSourceDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire target definition marshaller -->
+ <component name="javaWireTargetDefinitionMarshaller">
+ <system:implementation.system class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireTargetDefinitionMarshaller"/>
+ </component>
+
+ <!-- Builder registry -->
+ <component name="builderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.physical.DefaultPhysicalComponentBuilderRegistry"/>
+ </component>
+ <component name="wireAttacherRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.physical.WireAttacherRegistryImpl"/>
+ </component>
+ <component name="providerBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.DefaultIFProviderBuilderRegistry"/>
+ </component>
+
+ <component name="reflectiveIFProviderBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.ReflectiveIFProviderBuilder"/>
+ </component>
+
+ <!-- Java physical component builder -->
+ <component name="javaPhysicalComponentBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.java.JavaPhysicalComponentBuilder"/>
+ </component>
+
+ <!-- Federated deployer -->
+ <component name="federateDeployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.federation.FederatedDeployer"/>
+ </component>
+
+ <!-- Jetty HTTP service -->
+ <component name="httpService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.jetty.JettyServiceImpl"/>
+ <property name="httpPort">8000</property>
+ </component>
+
+ <!-- Calculator form servlet -->
+ <component runtimeId="slave1" name="calculatorForm">
+ <system:implementation.system class="org.apache.tuscany.demo.app.CalculatorForm"/>
+ <reference name="servletHost" target="httpService"/>
+ </component>
+
+ <!-- Servlet that handles the scdl submission -->
+ <component runtimeId="slave1" name="calculatorHandler">
+ <system:implementation.system class="org.apache.tuscany.demo.app.CalculatorHandler"/>
+ <reference name="servletHost" target="httpService"/>
+ </component>
+
+
+
+ <!--_________________________________________________________________________________________-->
+
+ <!--__________________________Legacy from launcher SCDL _____________________________________-->
+
+ <!--_________________________________________________________________________________________-->
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+ <!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+ -->
+ <!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+ -->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation"
+ scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava"
+ scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite"
+ scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation"
+ scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation"
+ scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">
+ 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/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system
+ class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <component name="launchedLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedLoader"/>
+ </component>
+
+ <component name="launchedComponentLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentTypeLoader"/>
+ </component>
+
+ <component name="launchedComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentBuilder"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="loaderExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="incompatibleServiceContractExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/etc/runtime.properties b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/etc/runtime.properties
new file mode 100644
index 0000000000..cd1e824731
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/etc/runtime.properties
@@ -0,0 +1 @@
+domain=federation-demo \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/system.scdl b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/system.scdl
new file mode 100644
index 0000000000..302146ca91
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/demo/src/main/profiles/slave2/system.scdl
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+<!--
+Default system configuration for the launcher environment.
+
+$Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System" autowire="true">
+
+ <!-- Work manager -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <!-- JXTA network configurator -->
+ <!-- component name="networkConfigurator">
+ <system:implementation.system
+ class="net.jxta.platform.NetworkConfigurator"/>
+ <property name="principal">principal</property>
+ <property name="password">password</property>
+ </component-->
+
+ <!-- Discovery service -->
+ <!--component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jxta.JxtaDiscoveryService"/>
+ <property name="interval">5000</property>
+ <reference name="configurator" target="networkConfigurator"/>
+ <reference name="workScheduler" target="workScheduler"/>
+ </component-->
+
+ <!-- JMS discovery service -->
+ <component name="discoveryService">
+ <system:implementation.system
+ class="org.apache.tuscany.service.discovery.jms.JmsDiscoveryService"/>
+ <property name="topic">tuscany.federation</property>
+ </component>
+
+ <!-- Marshaller registry -->
+ <component name="marshallerRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.DefaultModelMarshallerRegistry"/>
+ </component>
+
+ <!-- Changeset marshaller -->
+ <component name="changeSetMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalChangeSetMarshaller"/>
+ </component>
+
+ <!-- Wide definition marshaller -->
+ <component name="wireDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalWireDefinitionMarshaller"/>
+ </component>
+
+ <!-- Operation definition marshaller -->
+ <component name="operationMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.PhysicalOperationDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java component definition marshaller -->
+ <component name="javaComponentDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalComponentDefinitionMarshaller"/>
+ </component>
+
+ <!-- Reflective IF provider definition marshaller -->
+ <component name="reflectiveIfProviderDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.instancefactory.ReflectiveIFProviderDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire source definition marshaller -->
+ <component name="javaWireSourceDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireSourceDefinitionMarshaller"/>
+ </component>
+
+ <!-- Java physical wire target definition marshaller -->
+ <component name="javaWireTargetDefinitionMarshaller">
+ <system:implementation.system
+ class="org.apache.tuscany.core.marshaller.extensions.java.JavaPhysicalWireTargetDefinitionMarshaller"/>
+ </component>
+
+ <!-- Builder registry -->
+ <component name="builderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.physical.DefaultPhysicalComponentBuilderRegistry"/>
+ </component>
+ <component name="wireAttacherRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.physical.WireAttacherRegistryImpl"/>
+ </component>
+ <component name="providerBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.DefaultIFProviderBuilderRegistry"/>
+ </component>
+
+ <component name="reflectiveIFProviderBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.component.instancefactory.impl.ReflectiveIFProviderBuilder"/>
+ </component>
+
+ <!-- Java physical component builder -->
+ <component name="javaPhysicalComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.java.JavaPhysicalComponentBuilder"/>
+ </component>
+
+ <!-- Federated deployer -->
+ <component name="federateDeployer">
+ <system:implementation.system
+ class="org.apache.tuscany.core.deployer.federation.FederatedDeployer"/>
+ </component>
+
+
+ <!--_________________________________________________________________________________________-->
+
+ <!--__________________________Legacy from launcher SCDL _____________________________________-->
+
+ <!--_________________________________________________________________________________________-->
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system
+ class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system
+ class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system
+ class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system
+ class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+ <!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+ -->
+ <!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+ -->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader"
+ scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding"
+ scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation"
+ scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava"
+ scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite"
+ scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation"
+ scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation"
+ scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">
+ 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/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system
+ class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system
+ class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <component name="launchedLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedLoader"/>
+ </component>
+
+ <component name="launchedComponentLoader">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentTypeLoader"/>
+ </component>
+
+ <component name="launchedComponentBuilder">
+ <system:implementation.system
+ class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentBuilder"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="loaderExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="incompatibleServiceContractExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/distribution/sca/tsss-demo/pom.xml b/sandbox/old/distribution/sca/tsss-demo/pom.xml
new file mode 100644
index 0000000000..b06c31003d
--- /dev/null
+++ b/sandbox/old/distribution/sca/tsss-demo/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tss-demo</artifactId>
+ <version>20070320-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Demo for The ServerSide Symposium</name>
+ <description>Projet to build the demo run at The ServerSide Symposium March 2007.</description>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>kernel</module>
+ <module>runtime</module>
+ <module>http.jetty</module>
+ <module>jms</module>
+ <module>console</module>
+ <module>core-samples</module>
+ <module>demo.app</module>
+ <module>demo</module>
+ </modules>
+</project>
diff --git a/sandbox/old/distribution/sca/web/LICENSE.txt b/sandbox/old/distribution/sca/web/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sandbox/old/distribution/sca/web/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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.
diff --git a/sandbox/old/distribution/sca/web/NOTICE.txt b/sandbox/old/distribution/sca/web/NOTICE.txt
new file mode 100644
index 0000000000..960b43965e
--- /dev/null
+++ b/sandbox/old/distribution/sca/web/NOTICE.txt
@@ -0,0 +1,19 @@
+=========================================================================
+== 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/).
+
+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.
+
+Please read the LICENSE.txt file present in the root directory of this distribution.
+
diff --git a/sandbox/old/distribution/sca/web/pom.xml b/sandbox/old/distribution/sca/web/pom.xml
new file mode 100644
index 0000000000..9863a37569
--- /dev/null
+++ b/sandbox/old/distribution/sca/web/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <artifactId>web</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Tuscany Web-Tier Distribution</name>
+ <description>Tuscany Distribution for web-tier (servlet) environments.</description>
+
+ <properties>
+ <sca.version>1.0-incubator-SNAPSHOT</sca.version>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp-host</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/servlet.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/distribution/sca/web/src/main/assembly/servlet.xml b/sandbox/old/distribution/sca/web/src/main/assembly/servlet.xml
new file mode 100644
index 0000000000..a2cf3765d1
--- /dev/null
+++ b/sandbox/old/distribution/sca/web/src/main/assembly/servlet.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <fileSets>
+ <!-- include legal and other files -->
+ <fileSet>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <!-- libraries to add to the webapp classpath -->
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <includes>
+ <include>org.osoa:sca-api-r0.95</include>
+ <include>org.apache.tuscany.sca.runtime:webapp</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+ </includes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+
+ <!-- libraries needed to boot the runtime -->
+ <dependencySet>
+ <outputDirectory>WEB-INF/tuscany/boot</outputDirectory>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime:webapp-host</include>
+ </includes>
+ <excludes>
+ <exclude>org.osoa:sca-api-r0.95</exclude>
+ <exclude>org.apache.tuscany.sca.runtime:webapp</exclude>
+ <exclude>org.apache.tuscany.sca.kernel:tuscany-host-api</exclude>
+ <exclude>org.apache.tuscany.sca.kernel:tuscany-api</exclude>
+ </excludes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/sandbox/old/doc/tuscany.databinding.ppt b/sandbox/old/doc/tuscany.databinding.ppt
new file mode 100644
index 0000000000..0b6f1c6dca
--- /dev/null
+++ b/sandbox/old/doc/tuscany.databinding.ppt
Binary files differ
diff --git a/sandbox/old/doc/tuscany.webinar.final.pdf b/sandbox/old/doc/tuscany.webinar.final.pdf
new file mode 100644
index 0000000000..729c843f1a
--- /dev/null
+++ b/sandbox/old/doc/tuscany.webinar.final.pdf
Binary files differ